Questions tagged [flutter-change-notifier]
189 questions
0
votes
1 answer
Provider updates variable, but the old value is passed into function that depend on it
I am using a provider to store the value of input fields in a form. On save() method the TextFields call a method on the FormInputProvider that updates the variable inputAnn that holds updated input values.
_inputAnn is listening to the variable…

James__pxlwk
- 71
- 1
- 7
0
votes
1 answer
How to create a dependency for ChangeNotifierProvider and make it wait to complete?
I have ChangeNotifierProvider object that uses data stored sqflite asset database which need to be loaded at the beginning as future. The problem is that ChangeNotifierProvider doesn't wait for future operation to complete. I tried to add a…

Nurol Alacaatli
- 81
- 10
0
votes
1 answer
Flutter Provider Error: The following ProviderNotFoundException was thrown building HomePage(dirty, state: flutter: _HomePageState#fb424):
My code was actually working and is currently working with the app built from the previous version of flutter. I built it again using the same code but with the Flutter 1.22 upgrade and its causing error now on Provider. Since, the code actually…

user14393768
- 1
- 1
0
votes
2 answers
Flutter: My screen doesn't update when I update my List in the provider trough functions
I have a List with functions in a Provider in my Main File. If I update this List trough the functions in my widget (by pressing the buttons), it seems to work but doesn´t change anything on the screen...
I have two Screens, which should be filed…

Nico
- 11
- 1
0
votes
2 answers
The argument type 'Future<>' can't be assigned to the parameter type ''
I am trying to build a GridView list. This all works when I create a simple list of 'players', but now I am trying to persist data using sqflite and I am getting an error:
Error: The argument type 'Future' can't be assigned to the parameter type…

MargotB
- 3
- 1
0
votes
1 answer
How to separate Model from Provider in Flutter?
Assume we have a model in our models/ folder:
class ProductModel {
final String id;
ProductModel(this.id);
}
and then we create a provider for this model in providers/ folder accordingly:
class ProductProvider with ChangeNotifier {...}
The…

boldnik
- 2,547
- 2
- 27
- 32
0
votes
2 answers
Flutter: Is there a better way to handle calling setState() for each condition in an if/else statement?
I have code that I think is not optimized. Basically, I want to change the value of errorString if a FirebaseAuthException occurs. Do I use a ChangeNotifier on this instead?
Future _signInWithEmailAndPassword(BuildContext…

Damanjit Hundal
- 328
- 4
- 17
0
votes
2 answers
Consumer not reacting to changes in ChangeNotifier in profile/release builds
I have a class which extends from ChangeNotifier, it manages the state of one widget:
MainSection _section = MainSection.SETUP;
MainSection get section => _section;
set section(MainSection value) {
_section = value;
// some code
…

svprdga
- 2,171
- 1
- 28
- 51
0
votes
1 answer
ChangeNotifierProxy Provider & ChangeNotifier Provider loses value when app is refreshed
I am using a ChangeNotifierProxyProvider to provide a class called DatabaseService. The provider is shown below
ChangeNotifierProxyProvider(
create:(_)=> DatabaseService() ,
update: (_,AuthService authService,…

Damon Mohan
- 1
- 1
0
votes
1 answer
Flutter/Dart - Use FutureBuilder alongside Normal non-asynchronous elements in my build?
I'm unsure of how to implement a FutureBuilder element alongside other non-asynchronous elements in my build tree. The fact that I'm using a Consumer which listens for changes within a ChangeNotifierprovider complicates things somewhat. Can I use…

Meggy
- 1,491
- 3
- 28
- 63
0
votes
1 answer
Flutter/Dart - Use something like ChangeNotifier or setState within Future?
I'm using SocialProvider with ChangeNotifier. I want it to update its Consumer listener widgets once the user logs in and after posting to a database on the web.
Currently, I'm calling a Future method which inserts the new values to a Shared…

Meggy
- 1,491
- 3
- 28
- 63
0
votes
1 answer
Flutter Popup Widget in a Provider - What context to pop it closed?
I have a ChangeNotifierProvider class that provides a popup to its Consumer Widgets. The popup function called "showPopup" contains a raised button which when pressed, logs the user in with Google, fetches their information, posts it to a mysql…

Meggy
- 1,491
- 3
- 28
- 63
0
votes
1 answer
Why won't any changes from NotifyParser render in the UI using Provider / ChangeNotifier / Streambuilder but will from a Service Class
Per the example code, any data coming from Ble_Service has no problems rendering changes in the UI via provider. But if I pass any of that data from Ble_Service to NotifyParser via changeParserInput() the json string makes it over but no matter the…

nejas
- 19
- 2
- 7
0
votes
1 answer
How to get integer value from one place to another using ChangeNotifier & Provide, Or BLOC?
I want a pageValue from main.dart to set value in carousel.dart and vice versa?
main.dart
double pageValue = 0;
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
children: [
…

Aakash Solanki
- 565
- 1
- 6
- 18
0
votes
1 answer
Flutter provider error: When an inherited widget changes
I don't think I'm dealing with providers very well. What is the correct code?
**import 'package:flutter/material.dart';
import 'package:geo_app/model/wether.dart';**
class UpdateWeather extends ChangeNotifier{
WeatherModel weathers =…

hyesujo
- 1
- 1
- 3