Questions tagged [flutter-change-notifier]

189 questions
1
vote
1 answer

Flutter what is the best approach to use navigator and ChangeNotifierProvider together

I'm new to flutter, this question may be a very basic one. I have a firebase phone auth login page to implement this, if the user is logged in, then navigate to home page else if the user is a new user, then navigate to the sign-up page The problem…
1
vote
1 answer

ChangeNotifierProxyProvider getting null value

I am new to flutter. In my application locale information is found when the user login. So the idea is when the user login, it will pass the locale to AppLanguage. I have written ChangeNotifierProxyProvider to get the locale inside authentication…
Janaka
  • 2,505
  • 4
  • 33
  • 57
1
vote
1 answer

How to use Flutter hooks with ChangeNotifer

Assume we have a complex Model with ChangeNotifer, so how should I automatically update the UI when model changes? Here is what I came up with, but looks weird, is it right, is there a better way of doing this? class Playground extends HookWidget { …
Ali80
  • 6,333
  • 2
  • 43
  • 33
1
vote
1 answer

How to close Functions in ChangeNotifier Provider Flutter

How to close a Function without disposing it. I needy this answer because when I log out, I need to close the functions in ChangeNotifier Class. This Is my ChangeNotifier Class: class ChatAndRequestProvider extends ChangeNotifier { bool…
1
vote
1 answer

Flutter: Resolving Error performing updateData, NOT_FOUND: No document to update

I'm having the following error when I try to update my userData in my firebase DB E/flutter ( 4756): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(Error performing updateData, NOT_FOUND: No document to update:…
1
vote
1 answer

How can I let my DropdownButton affect my TextFormField

I think this is probably not too complicated, but I am new to coding and don't understand this, nor could I find an explanation online that I could understand. In my app my AppBar includes both a title and a bottom, the title has been just text, and…
1
vote
2 answers

How to push a route from ChangeNotifier?

My question is quite simple: How do i initiate navigation from the ChangeNotifier? I have a dashboard setup with a consumer and i want to change the route depending on the result of certain operations in the ChangeNotifier Model. A similar question…
fideldonson
  • 581
  • 3
  • 15
1
vote
1 answer

Flutter Provider Consumer need to return null

Hi I use Provider (https://pub.dev/packages/provider) into my Flutter app. Now I want to manage the floating action button into a scaffold using a provider consumer, to be sure that the scaffold is not rebuilded when I need to hide the FAB…
Massimo Caroccia
  • 417
  • 2
  • 6
  • 14
1
vote
1 answer

Provider.of<> returning null with ChangeNotifierProxyProvider?

In my test code below I have a flag that determines whether to use a ChangeNotifierProvider or a ChangeNotifierProxyProvider. When I press the RaisedButton both approaches properly display my GroupEditorPage. const isUsingChangeNotifierProxyProvider…
buttonsrtoys
  • 2,359
  • 3
  • 32
  • 52
1
vote
0 answers

Update UI after property in model class changed

I have a list of base64 images comes from server and I have a class to cache them in temporary folder. Because caching process may take some time, images not showing in UI specially when image is large . I have a loading property in my model class…
BeHappy
  • 3,705
  • 5
  • 18
  • 59
1
vote
1 answer

Is Change Notifier with Provider/Scoped Model a bad State Management solution for Flutter?

In my Flutter projects, I usually tend to use Provider together with Change Notifier both for Dependency Injection and State Management purposes, because I find it to be so much more intuitive and less boilerplate than other solutions, and I've…
1
vote
1 answer

ChangeNotifierProvider dosen't create new ChangeNotifier instance

I have a Master-Detail page for tablet. I want to change the details page when I select an item in the list. So I wrote code like this, class AttendancesModel with ChangeNotifier { final int userId; AttendancesModel(this.userId); …
1
vote
1 answer

Why is my "Data"."data" not updated in ChangeNotifier class using ChangeNotifierProvider?

I am new to flutter. I want to ask why when my text field's onChange did not trigger: "Provider.ofContext).updateData(newString);". The value of my Provider.of(context).data is not updated and with the 2 print statements, only 'called1' is always…
1
vote
1 answer

Encountering error while using ChangeNotifierProvider.value in Gridview.builder

This is likely a mistake and is unsupported. If you're in this situation, consider passing a key unique to each individual constructor. Above is the error which reflects on Running the code with a flutter widget as a child:- …
1
vote
1 answer

Flutter: Subtype Error when creating an widget with generics

I'm using viewmodels for my app that extend ChangeNotifier. To use them I'm trying to implement an generic base widget: class BasePageWidget extends StatefulWidget { final…