Questions tagged [flutter-change-notifier]

189 questions
0
votes
0 answers

Error in flutter application: "Could not find the correct Provider above this Widget"

I'm trying to use a ChangeNotifierProvider in my flutter application but end up with the above error. Any guidance would be greatly appreciated, thanks so much! This is the part of my home screen with the provider class UserHomePage extends…
0
votes
1 answer

how to dynamiclly change icon using provider in flutter?

How to change icon when the product item was added in to cart? I am using provider for writing some logic of adding items to cart. The function works fine, but I don't get it how to dynamically change icon if only one item was added. I don't want…
0
votes
0 answers

ChangeNotifierProvider not re-rendering the UI (Flutter,Dart,Provider)

I have a BaseView that contains ChangeNotifieProvider and Consumer which will be common to use anywhere. This Widget also receives Generic types of ViewModel. It has onModelReady that to be called inside init state. Also using get_it for Dependency…
0
votes
1 answer

Future builder runs forever, if memoizer used doesnt notify to the listerners

I am trying to switch the drawer tab, according to the value stored in shared preferences using the following code. code works fine when memoizer is not used but future builder runs forever. If I use memorizer future builder still runs at least two…
user12680761
0
votes
4 answers

Why does ChangeNotifierProvider exist?

According to Flutter's documentation here (https://flutter.dev/docs/development/data-and-backend/state-mgmt/simple), one way to control the state management is to use ChangeNotifierProvider(or InheritedWidget) when one of its descendants is a…
yoni keren
  • 300
  • 2
  • 14
0
votes
0 answers

Provider cannot get value

i am building mobile app using flutter. i try to use provider but it doesn't get the value. this is the code for class change notifier class StoreProvider with ChangeNotifier{ UserServices _userServices = UserServices(); StoreServices…
0
votes
0 answers

Theargument typeListViewFunction(BuildContext,TransactionProvider,Widge)can'tbeassignedtotheparametertype'WidgetFunction(BuildContext,dynamic,Widget?)

body: Consumer( builder: (context, TransactionProvider provider, Widget child) { return ListView.builder( itemCount: 4, //จำนวนเมนูช่อง 4 itemBuilder: (context, int index) { return Card( elevation: 6, margin: const EdgeInsets.all(10), child:…
0
votes
1 answer

How to fetch list of Data when page is open state notifier in consumer with using providerListener . Flutter

titleColor: Colors.black, resizeToAvoidBottomInset: false, backgroundColor: Colors.white, body: ProviderListener( provider: addressNotifierProvider.state, onChange: (context, state) { if (state is…
0
votes
0 answers

flutter safety use notifyListeners

A Model was used after being disposed. such like: Model(){ fetchData(); } void fetchData() async{ final r = await requset(); //...do something notifyListeners(); } when i use notifyListeners(),but the model had disposed. how to safety use…
lionnner
  • 13
  • 1
  • 5
0
votes
2 answers

How to take advantages of interfaces while using Providers?

Let's say I have 3 ChangeNotifierProviders "Auth1","Auth2","Auth3". I want all of them to implement login(),signup(),isAuthenticated(). So that I can replace one provider with another whenever I want. //Interface class IAuth { Future
Saravanan
  • 566
  • 5
  • 13
0
votes
1 answer

How can I solve "NoSuchMethodError (NoSuchMethodError: The setter 'uid=' was called on null"

I'm new ChangeNotifier provider flutter. I'm trying to get the user id from firebase. I want to query the data of current user from firebase. But when I run my app, the error happens. NoSuchMethodError (NoSuchMethodError: The setter 'uid=' was…
eight
  • 79
  • 1
  • 6
0
votes
2 answers

ChangeNotifier not updating Consumer

not sure why my ChangeNotifier isn't working. This is my Class: class LoadingProv with ChangeNotifier { bool globalLoading; void setGlobalLoading(bool truefalse) { if (truefalse == true) { globalLoading = true; } else { …
JoergP
  • 1,349
  • 2
  • 13
  • 28
0
votes
2 answers

Unable to create getter in Changenotifier class. error when using Provider in Flutter

hello i am new with provider. i wrote steps here where i have problem. 1- i called api after that i have data in my Model class. 2- then in ChangeNotifer class i want to make getter of list which is in Model class object. i am unable to add model…
0
votes
1 answer

Flutter - Could not find the correct Provider above this ChangeLocation Widget

I'm using both BlocProvider & ChangeNotifierProvider in my app. The flow of the app goes here:- first time user opens the app: InstructionPage() -> WelcomePage() -> HomePage() //getting error second time user opens the app: HomePage() //working…
0
votes
0 answers

ChangeNotifier Not updating widget

Im trying to update the listView below every time a new element (location) is added to the database but it is updated only once I close and reopen the app but not when the user navigate to LocationHistory page class LocationHistory extends…
Ah_Ch_97
  • 61
  • 1
  • 9