Questions tagged [flutter-state]

369 questions
2
votes
4 answers

How to load initial state data from sqlite database when Flutter app open

I'm making a simple Notepad app using flutter. I want to load already saved data from the SQLite database and initialize the state when the app opens. I tried with the initState() method with the async method. But async methods are not working in…
2
votes
0 answers

Remove item from PopupMenuButton while it is open

I have a PopupMenuButton that displays some PopupMenuItem's generated from a List. Each item has a delete button, which removes the String from the list. The problem is that the popup menu doesn't get rebuilt after deleting an item,…
Magnus
  • 17,157
  • 19
  • 104
  • 189
1
vote
0 answers

Handling 2 different sliverlist state on a single page in flutter

I am trying to create Instagram clone with a different design. So I was trying to add option between 2 different sliverlist, as per the selection of a user to view either their posts or the posts they have been tagged in. Following are different…
Ishan Sahu
  • 91
  • 8
1
vote
0 answers

Is it possible to move a stateful widget to another part of the widget tree and keep the state?

I have a custom StatefulWidget that I want to use on multiple screens (it's kind of a sidebar). However, I want to preserve the state of the widget when the user navigates from one screen to another. What's the best way to do that? My first attempt…
Magnus
  • 17,157
  • 19
  • 104
  • 189
1
vote
2 answers

How to handle navigation while an HTTP request is made in Flutter?

In my Flutter App, there are 2 screens called "home screen" and "data screen". In data screen I am making a GET Http request to a server and after if request is successful, I need to change some state using riverpod providers. Data screen http…
1
vote
2 answers

GetX (state management) STOP updating

I notice that GetX package hasn't update for 13 months, more than 1 year & still stand at version 4.6.5. Compare to other state management packages, it's very long days. GitHub repo has latest update 4 months ago. Is the era of GetX coming to the…
1
vote
1 answer

Keep Carousel position between pages

I have built a Carousel with weather images and text which works fine. However, when I navigate to another page and then navigate back to my page with the carousel the carousel has reverted back to the first position. How can I keep the last…
1
vote
1 answer

How can I use Riverpod together with the video_player package?

I am currently in the process of learning Flutter through a book and I've stumbled upon an issue I can't solve by myself. This is the very first time I ask something on stackoverflow so I apologise if it's not clear. I have a video I want to play…
1
vote
2 answers

Riverpod stateNotifierProvider state is null

Even after setting the state of Riverpod stateNotifierProvider, the state is null when used in the widget. I have this provider final imageNotifierProvider = StateNotifierProvider.autoDispose( (ref) =>…
1
vote
1 answer

Why is my text not updating in my widget?

I'm trying to make a simple timer using Riverpod and changeNotifier So I followed the todo example of the doc and came up with that : class ClickTimer { ClickTimer({required this.startTime}); int startTime; } class TimerNotifier extends…
Coca95
  • 31
  • 5
1
vote
1 answer

How do i push build context onTap on BottomNavigationBar i want to show changes when i navigate to any page from BottomNavigationBar

I used BottomNavigationBar for bottom bar which changes the current index page but I have some issue with the navigation. When I change the image on any screen, the changes show on inner pages but not show on that pages with navigate through…
1
vote
1 answer

Flutter UI is refreshed only after quick reload when using GetX

I'm trying to use GetX to change the color of a selected "Category", that comes from a list of categories. Currently, in the background the values are changing as expected, but the UI is not refreshed. I tried both GetBuilder and Obx to have my UI…
Headake
  • 33
  • 6
1
vote
1 answer

Accesing a BLoC using getit instead of context not working

I am trying to access a BLoC instance without actually using the context, but getIt instead. The versions I have are: flutter_bloc: ^8.1.1 injectable: ^2.1.0 get_it: ^7.2.0 injectable_generator: ^2.1.3 I have the BLoC registered in getit…
1
vote
1 answer

Flutter dropdown with getX not working properly on some devices

I'm using getx for state management,here's the video of the problem https://drive.google.com/file/d/1tm2M46pkXVnGuf4vyh9rNs2HY2TdtBD8/view?usp=sharing here is my code class ActivitiesController extends GetxController { late List
1
vote
1 answer

How to start Flutter app with loading, using state pattern with provider

I'm building my first app, and for state management I'm using ValueChangeNotifier and Provider with the state pattern. But when I start my app, I get the following error: Exception has occurred. FlutterError (setState() or markNeedsBuild() called…