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
-1
votes
1 answer

Flutter Provider: Using Stream Listener inside Provider to update data in realtime

Inside one of my Providers I want to listen to a Stream. For the sake of clarity I simplified the code and Stream by having just int values. In reality this can be a Stream from Firestore snapshots to listen to. class MyProvider with ChangeNotifier…
Dalon
  • 566
  • 8
  • 26
-1
votes
1 answer

Prevent build whole list when element is updated

I'm using Provider in my project, I have big list of custom object (comments), If I have about 1,000 comments in the list, when I update an item in the list, let's say I like some of comments and changing the isLike bool from false to true, it…
-1
votes
1 answer

Providers in flutter

I am building a note app with details of title and description whereby my input comes from a textfield from an alertDialog popup. Unfortunately, the screen is blank. This is my UserNotes class UserNotes{ String? title; String? descriptioin; …
-1
votes
2 answers

How to solve setState() or markNeedsBuild() called during build error in Flutter when using Provider?

I get the following error while using Provider in Flutter : The following assertion was thrown while dispatching notifications for CampaignProvider: setState() or markNeedsBuild() called during build. This _InheritedProviderScope
iamflubin
  • 59
  • 6
-1
votes
1 answer

List on HomeScreen not updating after editing an item in TaskScreenin Flutter

I am trying to do a todoapp with Provider but it is not working as expected. In my HomeScreen, I have a list of tasks, which is being stored in the provider. To edit a task, I go to another screen, TaskScreen, where I submit a form and, ideally, it…
bringand1
  • 103
  • 1
  • 8
-1
votes
1 answer

Change color when onPressed in flutter using Provider

How can I change the color using Provider State Management instead of setState() I have one Button by default color is black then - 1st click color is blue, 2nd click color is red, 3rd click color is green 4th click color is black(by default) or…
Ravindra S. Patil
  • 11,757
  • 3
  • 13
  • 40
-1
votes
1 answer

Database getting locked while showing data in listview

Warning database has been locked for 0:00:10.000000. Make sure you always use the transaction object for database operations during a transaction. I received this error while showing data in screen. And it takes too long so I have to reduce…
-1
votes
1 answer

Flutter Stream provider Couldn't Find The Correct Provider rror

I am trying to have stream provider for checking network connection, however it always return the same error. "couldn't find the correct provider above your child widget. I tried different structures but none work. Edit: Stream provider and widget…
Mark Nugromentry
  • 195
  • 2
  • 10
-1
votes
1 answer

Does using multiple consumers on the same screen affect the performance when using provider in flutter?

when using the provider package in flutter ,you can warp the scaffold with a consumer but then on every notifylisteners call the whole screen will rebuild so I used consumer only for the widgets that depend on the provider, but I was told that doing…
-1
votes
1 answer

Flutter web - Set state based on url

I am developing a flutter website with a persistent navigation bar on top that displays the current page the user is on, by adding a border around the title of the active page as shown below. I am using url navigation on the website, so the user…
-1
votes
1 answer

How to update the specific widget using provider ? below example scenario I have created for explaining the issue

Here I don't want to rebuild or update other widgets, I have to put the consumer at upper level @override Widget build(BuildContext context) { PositionProvider positionProvider = Provider.of(context, listen: false); return Scaffold( appBar:…
-1
votes
1 answer

how to set values in initState method using riverpod

right now i have a ChangeNotifierProvider, and i want to set some values straight in the initState method. those values come from a backend API, that are retrieved in that provider. I am stuck is this situation for a while now, hope i can get some…
filipe
  • 139
  • 2
  • 17
-1
votes
2 answers

How to redirect to another page using flutter provider

How to redirect to another page automatically after a delay in flutter using provider state management?
Aju Alex
  • 56
  • 7
-1
votes
3 answers

FutureBuilder shows the loading indicator althought the result is cached

I'm facing an issue trying to use FutureBuilder with Provider and cache. The computation is done one time and then its cached. The code looks like this: FutureBuilder( future: model.calculateStats(chartType: getChartType()), builder:…
user10027134
-1
votes
1 answer

Is it convenient to fully code the UI and only after build the Business Logic [Flutter]?

I’m planning the development of my flutter application (solo developer). It’s going to be a huge project (firestore integration, firebase remote configuration, revenuecat in-app purchases, algolia smart search, etc.) so I’m planning everything…