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.

flutter-provider
Filter by
Sorted by
Tagged with
0 votes
0 answers
40 views

Flutter Provider issue

State management uses Provider, and the design pattern uses the MVVM pattern. Simply put, the current issue is that there is a problem with the value being initialized when retrieving viewModel data ...
user23597482's user avatar
0 votes
1 answer
56 views

How can I use Provider to provide both initial values and save changed values in TextFields?

I have an app with a simple data model Note( String title, String content ) The part of the UI I'm asking about is basically a Row with a ListView displaying note titles next to a ...
Al C's user avatar
  • 5,271
0 votes
1 answer
31 views

Flutter Single responsibility principle with Provider package - clean code

I am trying to understand how to better write my Flutter application as right now with the current approach, the size of my service file is getting out of hand. Here is my use case (simplified): I ...
Robert J.'s user avatar
  • 2,661
0 votes
1 answer
67 views

Why is the cursor in a TextField jumping to the beginning of the text whenever the onChanged event is triggered?

My app has (among other things) a TextField and ElevatedButton. I'm managing state with Provider. I want the button color to change from white to blue when the TextField's content changes. I have this ...
Al C's user avatar
  • 5,271
0 votes
0 answers
16 views

Flutter get data infinitely with using provider

On the splash_screen, check the cookie of the user. So, if the user login the app or already has a cookie, below code executed. _navigateToHome() { Timer( const Duration(seconds: 3), ...
Jay's user avatar
  • 49
0 votes
1 answer
20 views

How to integrate Riverpod Provider State and page naviagtion

I have a categories widget with the following code: build(): final meals = ref.watch(mealsProvider); ... void _selectCategory(BuildContext context, Category category, List<Meal> meals) { ...
Ziad Ghanem's user avatar
-1 votes
1 answer
33 views

Flutter Riverpod unable to rebuild widget with ref.watch

My app structure is Categories -> Meals -> MealDetails -> EditMeal My code: MealNotifier: class MealsNotifier extends Notifier<List<Meal>> { @override List<Meal> build() ...
Ziad Ghanem's user avatar
0 votes
1 answer
36 views

Flutter Riverpod provider widget not rebuilding

This is my code: class MealsNotifier extends Notifier<List<Meal>> { @override List<Meal> build() { return userMeals; } updateList(List<Meal> meals) { state = ...
Ziad Ghanem's user avatar
0 votes
1 answer
28 views

how to Navigate from Listview Builder and access and show the selected Product in Flutter using provider?

I made an e-commerce app . i used the list view builder for listing the products. Now i need to display the product details page when tapped on the the desired list . How can i access the product i ...
Midhun S's user avatar
0 votes
0 answers
19 views

setState() or markNeedsBuild() called during build problem

I'm trying to remove the consumer @override void initState() { super.initState(); WidgetsBinding.instance!.addPostFrameCallback((timeStamp) { final provider = Provider.of<...
walid's user avatar
  • 7
0 votes
0 answers
154 views

Flutter | Background_fetch: fetching data based on provider, in background

I have some doubts about background task, using plugins like background_fetch or workmanager. I'm writing an app which has some provider organized hierarchically, that fetch and store some data from ...
Phoenix's user avatar
  • 95
0 votes
2 answers
33 views

Flutter AuthProvider Not Updating UI After Login

I'm facing an issue with state management in my Flutter app, specifically with updating the UI after logging in. While my AuthProvider works well for logging out and updates the UI accordingly, it ...
StativBus's user avatar
0 votes
0 answers
14 views

Instantiating ChangeNotifierProvider with Parameter

I am trying to instantiate a provider with an id passed through a route, the db call keeps failing as the id passed to it is blank not the value passed in. (Feel free to ignore this next wordy bit if ...
aliceParry42's user avatar
0 votes
1 answer
41 views

when i add video youtube i got error when it is empty

i got red screen when the fvideo is empty late YoutubePlayerController? _controller; @override void initState() { super.initState(); final videoID = YoutubePlayer.convertUrlToId(...
walid's user avatar
  • 7
0 votes
1 answer
39 views

How do I run a dialog function when a value in my provider changes to 1?

The standard way to show a dialog box: https://api.flutter.dev/flutter/material/showDialog.html Instead of a button, I want to show a dialog when a variable in my provider changes from 1 to 0. My view ...
TheMortiestMorty's user avatar
0 votes
0 answers
26 views

Unable to Navigate to Other Screens After Logging In Flutter

After logging in to the Flutter app, I am redirected to the home screen, but I'm unable to navigate to other screens such as Messages or Profile. The navigation bar appears correctly, but when I tap ...
Gravis's user avatar
  • 1
0 votes
0 answers
45 views

How to pass different Riverpod Ref types to a callback?

I will omit any code here, as this question is rather conceptual. I'm currently developing a Flutter App using riverpod to manage the components of the app-wide state, such as session tokens, etc. I ...
DevelJoe's user avatar
  • 1,052
0 votes
0 answers
41 views

How can I efficiently handle initialization and disposal of TextEditingController with Provider in Flutter?

I'm encountering issues with accessing deactivated widget ancestors when disposing of the controller. import 'package:exposed/constants/colors.dart'; import 'package:exposed/providers/...
Shayan Ali's user avatar
0 votes
1 answer
36 views

Why does the Futurebuilder widget show an old snapshot?

I have a Flutter Web project. I have two pages mainly: one where I list sports, and another where I modify a particular sport. To navigate I use the context.router.navigateNamed method of the ...
ldiaz997's user avatar
0 votes
2 answers
44 views

flutter reload page not working when i use provider

I'm using provider. The problem in the code below is that I can't reload the API. @override void initState() { super.initState(); getData(context); } Future<void> getData(...
walid's user avatar
  • 7
0 votes
1 answer
65 views

Flutter setstate or markneedbuild called during build

setState() or markNeedsBuild() called during build. This is the code: import 'package:flutter/material.dart'; import 'package:learningplatformapp/AllClass/trainer.dart'; import 'package:...
walid's user avatar
  • 7
0 votes
1 answer
67 views

Consuming a FutureProvider and a StreamProvider in a widget

I have two data models a) Product b) Jobs I create Stream Provider in main.dart _MyAppState class (top most widget). It reads a collection from firestore. MultiProvider( providers: [ ...
pbs_mhl's user avatar
  • 17
0 votes
1 answer
65 views

How to use Provider's ChangeNotifier with a stateful widget?

I am building a photo editor in Flutter. My home page contains variables such as a list of layers and the currentlySelected layer. My home page has a child widget, Toolbar, which needs access to ...
Dylan Wolf's user avatar
0 votes
3 answers
65 views

How do I provide an existing provider from `main` to `app`

In Flutter I currently have the following basic app structure (simplified): class MyProvider extends ChangeNotifier { String get value => 'Hello!'; } void main() { runApp(const MyApp()); } ...
katkak's user avatar
  • 187
0 votes
0 answers
18 views

Using Selector for a StreamProvider along with FutureProvider - avoid Null until future returns successfully?

I'm using a StreamProvider and FutureProvider in a StatefulWidget in my flutter app like - class _ScheduledDeliveryState extends State<ScheduledDelivery> { List<Product>? productList; @...
pbs_mhl's user avatar
  • 17
0 votes
1 answer
79 views

Update external values with WorkManager

I have a provider where I have a list of tasks, it happens that, I want to implement a way in which after a specific time, I would like to remove a task from the list. class TaskProvider extends ...
Yasuki's user avatar
  • 15
0 votes
1 answer
60 views

Riverpod AsyncValue stuck at loading and constantly tries to make api call

I am trying Riverpod with code gen. I couldn't fix this for a while. when function stuck at loading and my code tries to make infinite API calls. I am following the example pub app at the riverpod ...
Yigit Kaya's user avatar
0 votes
0 answers
12 views

Stream issue with StreamProvider

I'm using StreamBuilder to listen to changes in user authentication and then StreamProvider to fetch data from Firestore while constantly listening to changes in user documents. I sometimes got ...
Mateusz Pastewski's user avatar
1 vote
1 answer
29 views

Data from FutureProvider prints two different variables who have same value for an instance only once , why?

I have a data model Product whose data is stored in firestore. When I read its data using Provider and print the fields of product dim_x and dim_y, I only get values printed which are different. For ...
pbs_mhl's user avatar
  • 17
2 votes
1 answer
35 views

Flutter - Can't refresh data after Navigator.push with firestore

I'm trying to make a favorites widget that will display items that have been added as "favorites" for the current user. So lets say I click on a favorite item called "Pizza", it ...
klopton2662's user avatar
0 votes
0 answers
81 views

Get fresh data from firestore with riverpod provider in flutter

I am trying to get my provider to fetch fresh values from firestore. I have a provider which is fetching values from firestore and provides them wihtin the app as stream. Stream from firestore Stream&...
DeKekem's user avatar
  • 1,139
0 votes
0 answers
37 views

Flutter: Getting an error about using notifyListeners in a class that doesn't extend ChangeNotifier, but it seems to work?

I have these two problems reported by vscode 98 times in my project, every time that I use classModelName.notifyListeners to update the state using the provider: The member 'notifyListeners' can only ...
RJrules64's user avatar
1 vote
3 answers
107 views

Flutter: Dynamically Updating Icon in AppBar Based on ChangeNotifier State

I'm developing a Flutter app where I have a ChangeNotifier service that manages file upload processes. This service has a boolean isUploading property that tracks whether files are currently being ...
devgibiadam's user avatar
1 vote
0 answers
109 views

Flutter in App Purchases purchase stream doesn´t fire after buying an item

I am currently trying to add in app purchases to my flutter app. For implementing I used the in_app_purchases package and the google codelab My Code is very similar to the codelab: I have a Purchases ...
xd0007's user avatar
  • 31
0 votes
1 answer
35 views

The values for lat,lng returned by the provider are received as null in another page

I am obtaining latitude and longitude using the location. The code below is what I have set up. The reason I used a Provider here is that the latitude and longitude values change whenever the location ...
user23337424's user avatar
0 votes
0 answers
26 views

Does listening to a stream using Provider works same as listening once in initState() without the Provider

From the state changes point of view and firebase cost, does using data = Provider.of<MyModel>(context); Or maybe Consumer() in build method, with a StreamProvider. works same as @override ...
pbs_mhl's user avatar
  • 17
0 votes
0 answers
24 views

RawAutocomplete not showing options

I'm getting my RawAutocomplete options from firestore using Consumer widget of provider. I do not get any error, but no suggestion options are shown below my RawAutocomplete TextField. Could you ...
pbs_mhl's user avatar
  • 17
0 votes
0 answers
47 views

How can I change the state of a bool using Riverpod State Management?

I'm trying to change the status of the 'TaskCard' from false to true after pressing on the 'ElevatedButton' in 'task*-details-page*.dart' I tried solving this problem without using riverpod as well, ...
xDelusion's user avatar
0 votes
1 answer
17 views

Flutter notification/value provider across widget tree

I have the following views: SettingsView (Stateless) - updates SharedPreferences on ToggleButton. HomeView (Stateful) - Displays an TestWidget if the SharedPreference has the value true (say ...
banerjk's user avatar
  • 365
0 votes
1 answer
56 views

How to use flutter provider in main.dart

This is my code of my main.dart where I wrapping with multiprovider also using socket io . I want that as soons as socket payload comes provider list is populated with the data import 'package:...
Prasenjit Das's user avatar
0 votes
0 answers
60 views

Best practices for using MVVM with Provider in Flutter

I have a Flutter app that uses Provider package together with MVVM pattern. I'm always trying to make the viewModel responsible only for the functionality related to specific View but there is one use ...
Petr G's user avatar
  • 45
0 votes
2 answers
52 views

How to use flutter provider in initState

This the provider details I am having //is_products_changed_provider.dart import 'package:flutter/material.dart'; class IsProductChangedProvider extends ChangeNotifier { bool isTheProductChanged = ...
Prasenjit Das's user avatar
0 votes
2 answers
47 views

Increment and decrement issue in Flutter project

I am having some issues in my code. I am trying to create a product cart where a user clicks on the + button to increase the quantity of products and clicks on - button to decrease the quantity of ...
Abiodun Bankole's user avatar
0 votes
0 answers
44 views

flutter: using MVVM, provider, http, dependency injection and repository pattern, error

this is my flutter app file structure i am trying to uses the mvvm structure but i keep coming ap on an error message Too many positional arguments: 0 expected, but 1 found. for my di code final ...
ema lex's user avatar
2 votes
1 answer
136 views

Riverpod state is null after returning in the build of the notifier

I have this notifier: class AsyncPlayerNotifier extends AsyncNotifier<PlayerData> { @override Future<PlayerData> build() async { return const PlayerData( PlayerRequestState:...
Ahron Gold's user avatar
0 votes
1 answer
41 views

Can't Call Widget From Another Widget but Can From Main

I'm trying to make a simple app, where I have a slider that controls a timer set value. The user then hits a start button to start the timer and stop button to stop the timer. I've created a ...
hallibut's user avatar
  • 198
0 votes
0 answers
19 views

Automatically show Form widget below textfield upon entering certain number of characters if data not found in firestore

I want to create a flutter web app page (& android tablet app) where have a form with text fields. When user starts typing in a field it would fetch previous documents(products) from firestore ...
pbs_mhl's user avatar
  • 17
0 votes
0 answers
40 views

Flutter widget is refreshed after popping it when using provider

I hope I will be able to explain it correctly, but my issue is basically that after popping from tab A to ExpandItemTab, ExpandItemTab is rebuilt event after pop. After I delete the item from the item'...
cinnamon's user avatar
0 votes
1 answer
39 views

Error: Could not find the correct Provider<ThemeProvider> above this MyApp Widget

I've got a problem, my code doesn't work. I've looked through some of the already existing posts, but nothing has worked. my main.dart looks like this import 'package:flutter/material.dart'; import '...
EinManu_'s user avatar
0 votes
0 answers
42 views

My Provider return a null value despite it exists

First I put the code of the classes: The Home class: class Home extends StatelessWidget { final AuthService _auth = AuthService(); Home({super.key}); @override Widget build(BuildContext ...
Geremia Moretti's user avatar

1
2 3 4 5
31