import 'dart:html';
import 'package:flutter/material.dart';
class SearchScreen extends StatefulWidget {
const SearchScreen({Key? key}) : super(key: key);
@override
_SearchScreenState createState() => _SearchScreenState();
}
class _SearchScreenState extends State<SearchScreen> {
TextEditingController userCurrentLocationTextEditingContrpller = TextEditingController();
TextEditingController photoShootLocationTextEditingControler = TextEditingController();
@override
Widget build(BuildContext context) {
String placeAddress = Provider.of<AppData>(context).userCurrentLocation.placeName ?? "";
userCurrentLocationTextEditingContrpller.text = placeAddress;
}
But I get these errors:
Error: 'AppData' isn't a type.
String placeAddress = Provider.of<AppData>(context).userCurrentLocation.placeName ?? "";
Error: The getter 'Provider' isn't defined for the class '_SearchScreenState'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Provider'.
String placeAddress = Provider.of<AppData>(context).userCurrentLocation.placeName ?? "";
Seems like you forgot to add imports to the file. For Provider try adding something like
Than you should also import your AppData in the file. I can't really guess what this import will look like, but your IDE might suggest it to you. For example in VScode if you click on the AppData - a lightbulb will appear and upon clicking it, it will suggest to import a package with AppData you are looking for