Questions tagged [flutter-state]

369 questions
2
votes
2 answers

Continuous error of Null check operator used on a null value

I am making an app with a page view and a custom bottom navigation bar CustomBottomNavigator. The icons change color when pages are changed but whenever I implement Ontap method for the individual CustomBottomNavigatorItem it gives a null check…
2
votes
0 answers

Flutter sqflite red query error using Cubit state management

i want to build a crud application using sqlite and Flutter Cubit, the problem is that when i want to red data from my database it return an error. i test my query in console it work prefect but when i use with Listview it dos not working. i though…
maliha arash
  • 153
  • 2
  • 14
2
votes
0 answers

how to stop stream provider in flutter when I log out?

I am building a mobile app using flutter. I would like to enable my stream provider when I log in and disable my stream when I log out.Also, I would like to keep streaming even if I leave the app and go to another app. The stream provides the phone…
castro
  • 37
  • 7
2
votes
1 answer

How to inject data into class when Provider can't be used? - Flutter

Im really struggling with this question, asking it right and even proper terminology so please help me out here. This is probably an easy fix under the proper question syntax that I'm unaware of. If so I'll delete once I know the lingo. Goal I want…
RobbB
  • 1,214
  • 11
  • 39
2
votes
3 answers

initState() method of first activity is not initializing after taking popback stack from the aother activity

I am working on flutter application where I am using 3 screens. MainActivity open to ActivityClass1 and ActivityClass1 will open ActivityClass2. Now when I am taking Navigator.pop(context), from ActivityClass2 it will shows ActivityClass1 from the…
Kishan sharma
  • 701
  • 1
  • 6
  • 20
2
votes
0 answers

pagination with flutter bloc package loss scroll position

while am using flutter_bloc 6.0 I got a problem that I wrapped scaffold with bloc builder and when new state its value will be appended to the defined list of empty. well on new sate value appended but the UI rebuild all and lost the scroll position…
2
votes
5 answers

Updating a Stateless Widget from a Stateful Widget

Main.dart: import 'package:flutter/material.dart'; import 'package:mypackage/widgets/home_widget.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return…
Adam Brodin
  • 63
  • 1
  • 2
  • 13
2
votes
0 answers

flutter_bloc. Automatically disposes cubit/bloc when used directly in BlocBuilder

Does the code below automatically disposes the directly called instance (cubit in this case) if I called this directly. BlocBuilder( cubit: TestCubit(), // Direct call of cubit instance builder: (context,state){ .... …
GhoSt
  • 321
  • 2
  • 12
2
votes
1 answer

flutter multiple state management

I have a sized box like so child: SizedBox( width: 50.0, height: 50.0, child: DecoratedBox( decoration: BoxDecoration( color: Colors.blue ), ) ), i would like to change the…
user2293554
  • 379
  • 1
  • 7
  • 15
2
votes
1 answer

ChangeNotifierProxyProvider flutter not getting update from ChangeNotifierProvider

I am trying to access userModel.uid from UserProvider inside the ItemProvider so it can load _savedItems. However, when I call loadUserSavedItems(), _userId is null. Here is my main.dart import 'package:flutter/material.dart'; import…
2
votes
2 answers

Why stateless is mostly used than stateful widget in software development?

I wanted to make a commercial app. Everyone suggest me to make the whole app is stateless. Why we use a stateless widget instead of the stateful widget for making heavy software?
2
votes
2 answers

How to do random generator of elements of list?

I have list: List quotes = [ "Lmao this is text", "Okay okay go to next", "So, we are the champion nanana", "Gagagagaga", "What does the fox say?" ]; var _index = new Random(); And I want to create…
influtter
  • 23
  • 1
  • 4
2
votes
1 answer

Unable to work with Flutter Stateful widget

I'm Ravi. I am pretty much new to Flutter but I am not new to programming. I am Stuck working with stateful widgets of Flutter. Since i am new to this SDK i am unable to figure out why my state isn't getting updated. What i did was just wrote some…
Ravikiran
  • 512
  • 3
  • 14
2
votes
0 answers

Is a widget on screen?

I want to monitor which parts of my app the users interact with the most. So, I'm planning to create a custom widget that records and logs how long it is on the screen for, and how many times it gets pressed. My question is, is there a way to check…
2
votes
0 answers

Flutter DropdownButtonFormField not showing selected item

Using DropdownButtonFormField element to show a lists of cities. It works fine on change event and show the selected item on change event. Issue is that once I try to show selected item from set state its not working. Although state is successfully…
Haseeb Ahmad
  • 7,914
  • 12
  • 55
  • 133