Questions tagged [flutter-change-notifier]

189 questions
2
votes
1 answer

How to switch between Auth screen and Home screen based on bool value?

I want to switch between the login screen and Home screen based on bool value(user.status) from the model class below class User extends ChangeNotifier { int phoneNumber; bool status = false; notifyListeners(); } The bool User.status value is…
2
votes
1 answer

How to display a dialog from ChangeNotifier model

In my project, when ChangeNotifier class receives a status it sets up a boolean and calls notifyListeners(). In my main build() function, I then check the pending-boolean and display the dialog accordingly - but I am only able to display the dialog…
fideldonson
  • 581
  • 3
  • 15
2
votes
2 answers

An annoying problem with TabBar and ChangeNotifierProvider

Imagine a scenario like this. E.g: A whole bunch of movies with various genres. The idea is a TabBar and in each Tab contains a list movie of a genre. In this case, a ChangeNotifier e.g MoviesBloc will pretty much suit the need, ChangeNotifier…
Joe Ng
  • 91
  • 2
  • 7
1
vote
2 answers

Why is my UI not updating with the after getting notified by change notifier

I am working on an API in Flutter after spending a long time I managed to get the data I am using a provider and change notifier to update my UI. According to the data that I get, but the UI is not updating This is my API provider: class ApiProvider…
Abhiram
  • 145
  • 1
  • 1
  • 13
1
vote
1 answer

Does Flutter have a Listener that provides the new value directly to its listeners?

I know there are ValueNotifier, ChangeNotifier and of course Stream, but I can't find any class that can provide the new value directly to the listeners. I could of course create my own, but I'm wondering if there is such a class "built in" to…
Magnus
  • 17,157
  • 19
  • 104
  • 189
1
vote
1 answer

Why do we need ChangeNotifierProvider instead of just using a ChangeNotifier?

I am trying to learn how to use flutter_riverpod for state management, I am having trouble understanding what the "need" for ChangeNotifierProvider is , same thing for StateNotifierProvider. Let's take the following ChangeNotifier for example…
1
vote
0 answers

Flutter provider advice

I feel like this is a stupid question, but anyways... I want to improve the naming structure inside my provider by grouping functions together (and if possible, relocate the groups to separate files), so I can access them like this (and I want all…
1
vote
0 answers

Implemention of Dark/light theme mode in flutter

i am trying to create a way to start my app with system theme and then giving user a switch to choose between light mode and dark mode in my main.dart file import 'package:edubro/pages/Attendance/show_attendance.dart'; import…
1
vote
1 answer

List of interactive items using nested StateNotifiers

Do you think it's okay to have a list of StateNotifiers inside the State of other StateNotifier? For example like this: class ListOfItems extends StateNotifier { void doSomethingWithList() { // update state of list -> rebuild…
1
vote
1 answer

ChangeNotifierProvider not updating the listener

I have simplified my real app into the following code below to show the problem. I am basically trying to show the scroll offset of a list view on another widget (the real app is a lot more complex where the widget does other stuff with that…
1
vote
0 answers

using ChangeNotifier to add items into empty list

I already have data stored on firestore , but now i'd like to add this data into an empty list using ChangeNotifier , similar to this example -https://docs.flutter.dev/development/data-and-backend/state-mgmt/simple . so below i'd like to add data…
1
vote
0 answers

Prevent BottomBar from rebuilding the entire application in Flutter

I have an app with a bottom bar that is used to navigate between the three main tabs of the app using AutoTabsRouter.pageView(). The bottom bar is only visible in some parts of the app, so I need a function that controls its animation. Also…
1
vote
0 answers

How to combine StateNotifierProvider and FutureProvider in Flutter? | Riverpod

Basically I am trying to combine a FutureProvider and a StateNotifierProvider into one single Provider with Riverpod. I know that there is already a question for a similar thing, but this is a bit more complex. The scenario: The user is able to set…
Florian Leeser
  • 590
  • 1
  • 6
  • 20
1
vote
2 answers

Multiple ChangeNotifierProxyProviders to feed updates into ChangeNotifier

I have three ChangeNotifierProvider providers, let's call them A, B and C. What I need is for changes in providers A and B to update provider C, but the code below isn't working. MultiProvider( providers: [ ChangeNotifierProvider(create:…
1
vote
1 answer

How can I get my flutter video player to work for Chrome Web, correctly

I am getting videoplayer overflow. How do I resize my video player, so it correctly works. Error message "A RenderFlex overflowed by 93 pixels on the right" during window resizing. import 'package:flutter/material.dart'; import…
1 2
3
12 13