Questions tagged [flutter-state]

369 questions
0
votes
0 answers

How can TickerProvider vsync property be used inside ConsumerWidget/Stateless widget Riverpod | Flutter

The timer package I'm using made some breaking changes which are very helpful performance wise but this clashes with my design of ConsumerWidgets. So I'm wondering if there is a way to get this working without changing everything. This post gives a…
RobbB
  • 1,214
  • 11
  • 39
0
votes
0 answers

Flutter Cubit State Design for Navigation

Good day everyone! Let's imagine I am using Flutter Cubit with @freezed for an authentication screen. There are several ways on how to structure the state but all come with a problem I can't find a way around. I normally design my States like…
0
votes
1 answer

Pagination function that adds data to StreamController - Flutter

I am trying to implement pagination in my app but it's not working very well. So far, the code works to get the first 10 posts and their users but after that, it goes downhill. When a user reaches the last post, the getData() function is called…
Globe
  • 169
  • 11
0
votes
1 answer

Avoid no_logic_in_create_state warning when saving reference to State of StatefulWidget in Flutter

Using Flutter, I display a list of elements in an app. I have a StatefulWidget (ObjectList) that holds a list of items in its State (ObjectListState). The state has a method (_populateList) to update the list of items. I want the list to be updated…
Nereos
  • 101
  • 6
0
votes
0 answers

Flutter unusual error in errors_patch.dart

whenver I run my application, I run into this error in errors_patch.dart external static Never _throw(Object error, StackTrace stackTrace); here is my entire file if it helps import 'dart:convert'; import 'dart:io'; import…
0
votes
0 answers

Warn about unsaved state changes on flutter web

i try to do a form with flutter web but i want to show a dialog if users do unsaved changes before reloading/changing pages. I tried onwillpop but it doesnt detect page change when i press back button or change url to go other pages. Any suggestion…
0
votes
2 answers

Flutter - updating state and THEN navigating away

I have a stateful widget called AuthenticatingScreen where I'm trying to perform the following flow... Output message letting the user know we are logging them in Get user oAuth token (calls to service file) Update the message to let the user know…
Chris
  • 1,939
  • 1
  • 19
  • 38
0
votes
0 answers

How to use Bloc for beginner in flutter?

I am starting to use Bloc to manage state , I have learned that there are 3 types that are BlocBuilder, BlocListener and BlocConsummer, so which writing style is most commonly used? I have referenced many sample projects on github, but it has too…
lllionlll
  • 57
  • 6
0
votes
0 answers

How to add watch to state variable from separate cubit?

I am new to flutter and trying to add a watch on a variable of a state. Now from some FavoriteScreen cubit, if I had to watch this variable 'someKindOfList' which is present in ExploreLoaded state. How would I do it? I tried the following: class…
Biswas Khayargoli
  • 976
  • 1
  • 11
  • 29
0
votes
1 answer

Flutter lifting the state up through multiple dynamically added widgets

I'm trying to build a parent widget that has a button, when clicked, it displays another widget with some text and a drop-down list. When the drop-down selection is changed, the text should change accordingly. I've included below a simplified code…
Bialy
  • 905
  • 2
  • 12
  • 22
0
votes
1 answer

Clear button not changing state

I have a clear button that should be visible if the date and time fields are filled and not visible if they are empty. The logic part works but the state does not change and if both the textfields are filled the checkbox doesn't appear. I can't use…
Rohith Nambiar
  • 2,957
  • 4
  • 17
  • 37
0
votes
2 answers

Flutter TextEditingController.txt not updating on first build

I am trying to clean up my code a lot. I have a form that I realise I use multiple times in my app. So I wanted to turn the form into its own stateful widget so I could easily re-use it. Unfortunately this is proving more difficult than I…
Ten Digit Grid
  • 1,315
  • 4
  • 22
  • 43
0
votes
2 answers

set state in the on change

import 'package:flutter/material.dart'; bool jov = false; class boox extends StatelessWidget { const boox({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(), drawer: Drawer(), …
0
votes
1 answer

local state variable not updating

For some weird reason, my local state variable "_jobApplicationState" is not updating. I see that it is updated in the database, but its not updating on my page. If I leave the record and come back, everything works as expected. I am driving this…
Juan Casas
  • 268
  • 2
  • 13
0
votes
0 answers

Optionally Unmodifiable Class in flutter, dart

Tldr: is there an optional immutablity/unmodifiability in dart/flutter? Similar to unmodifiableList I would love to have something like myHugeObject.unmodifiable(). Is that possible? I am aware of immutability and libraries like freezed. Desired…
superfuzzy
  • 346
  • 2
  • 13