Questions tagged [flutter-provider]

For questions relating to the "Provider" package for the Flutter framework. Use this tag in combination with the general [flutter] tag. If your question applies to Flutter more generally, use the [flutter] tag only.

This tag should be used for any questions regarding the provider package for the framework.

The provider is a wrapper around InheritedWidget to make them easier to use and more reusable.

Provider uses InheritedWidget's to provide dependency injection functionality for state management in Flutter applications.

To get started, one can read through the README on GitHub, i.e. on the official GitHub page for the provider package.

1487 questions
0
votes
1 answer

Provider: create new model object per each sequence of pages

I am new to Provider. I am trying to use the provider model across multiple pages. I have 2 sequence of pages. In the first sequence, there is only one page IncrementerPage, which will just increment the count. In the second sequence, there is an…
Crazy Lazy Cat
  • 13,595
  • 4
  • 30
  • 54
0
votes
1 answer

How to detect auth changes with firebase_auth and provider

I've this simple login method in my Auth provider class Future login(String email, String password) async { try { AuthResult result = await _firebaseAuth.signInWithEmailAndPassword( email: email, password: password); …
0
votes
1 answer

Error: The method 'didChangeDependencies' isn't defined for the class 'ProxyProvider'

I updated Provider package. Now it's not wroking. ProxyProvider( update: (context, categoryRepo, categoryBloc) =>//builder: CategoryBloc(categoryRepository: categoryRepo), …
BIS Tech
  • 17,000
  • 12
  • 99
  • 148
0
votes
1 answer

How to build the architecture of a flutter app

I'm implementing a chat-based app in Flutter. I was thinking of using Provider package to create two main notifiers: UserService and ChatService. The first one handles the signIn (and all the other functions user-related), while the latter handles…
0
votes
0 answers

Flutter Provider - Trying to subscribe to Firestore collection before being logged in

I'm setting up a MultiProvider in main.dart which fails due to Firestore restrictions. 5.20.0 - [Firebase/Firestore][I-FST000001] Listen for query at terms failed: Missing or insufficient permissions. After logging in on the simulator it eventually…
William
  • 884
  • 2
  • 12
  • 23
0
votes
1 answer

builder is depreacated and shouldn't be used Flutter Provider

How to fix this issue? I tried to add create and How do I pass these parameters? ProxyProvider( builder: (context, yelloChatDb, userdAO) => UserDao(yelloChatDb), ), ProxyProvider( …
BIS Tech
  • 17,000
  • 12
  • 99
  • 148
0
votes
1 answer

Flutter ProxyProvider create failing

When trying to use ProxyProvider using the example syntax given in https://pub.dev/packages/provider Widget build(BuildContext context) { return MultiProvider( providers: [ ChangeNotifierProvider(create: (_) => Counter()), …
Martins Untals
  • 2,128
  • 2
  • 18
  • 31
0
votes
1 answer

Flutter package provider with templates

I'm trying to use provider with template, but Provider.of seems not working like that. Logs: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ The following ProviderNotFoundError was thrown…
Lyofen
  • 631
  • 6
  • 15
0
votes
2 answers

State handeling in Flutter with multiple pages

I'm trying to figure out a good way of architecturing a Flutter app. I have several pages, which can navigate to other pages. Data modified by one page, might be used by other pages and needs to be updated. I recently started using the Provider…
0
votes
1 answer

No able to get the latest state of an object using provider

I am trying get the latest state of the name variable from the Home class, but I am getting a null instead of the value Tenzin Nyidon. I initialize the name variable inside the build method of the MyHomePage as you can see, and set the…
user12152162
0
votes
1 answer

Fetch state-object from database

I want to get my state from database upon startup. I use provider with ChangeNotivierProvider at my first widget. Code included for clarification. This is my main method, it has the widget that provides the state i plan to use in the app: void…
jared
  • 473
  • 3
  • 16
0
votes
1 answer

Firestore queries in Flutter

I'm finding it really hard to understand the syntax for queries for cloud_firestore in flutter. I've not been able to make a single query for the past while and all my efforts to understand it are failing since there are different in many tutorials.…
0
votes
2 answers

how to rebuild provider Selector but not rebuild child of them

I know Consumer can do it by passing child widget as parameter to a child of the builder, but I don't know in Selector this is some docs https://github.com/rrousselGit/provider#my-widget-rebuilds-too-often-what-can-i-do
tbm98
  • 220
  • 2
  • 12
0
votes
3 answers

Dart how to return Future> instead of List>

I have an async function getProducts() that is supposed to return a Future> meant to a be fed to a FutureProvider. So far, I managed to return a List> instead: Future> getProducts( …
nader
  • 49
  • 9
0
votes
1 answer

What is the third input parameter in the Flutter ProxyProvider builder function

Given a ProxyProvider like the following, MultiProvider( providers: [ ChangeNotifierProvider( builder: (context) => MyModel(), ), ProxyProvider( builder: (context, myModel, anotherModel) =>…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393