skip to Main Content

Flutter – Why is there Error getting value from FutureBuilder?

class TodoList extends ChangeNotifier{Future<bool> GetLoginData() async { final SharedPreferences prefs = await SharedPreferences.getInstance(); notifyListeners(); return prefs.getBool('data')??false; }} class _CheckState extends State<Check> { Widget build(BuildContext context) { final x = Provider.of<TodoList>(context); print(x.GetLoginData().toString()); return FutureBuilder<bool>( future: x.GetLoginData(), builder: (context, snapshot) { if…

VIEW QUESTION

Flutter – FutureBuilder weird behaviour

I have a FutureBuilder which the future is this : Future<Tutor> future(Object? args) async { print("running future ...${args}"); String title = ""; String content = ""; final SharedPreferences prefs = await SharedPreferences.getInstance(); if (args != null) { debugPrint("args is not…

VIEW QUESTION

how to call setState inside FutureBuilder<List<dynamic>>in flutter

I am trying to call setState inside a ListView.builder which itself is inside a FutureBuilder FutureBuilder<List<dynamic>>( future: BidRepository().bidsTrucker('new'), builder: (context, snapshot) { if (!snapshot.hasData) { return const Center(child: CircularProgressIndicator()); } final trips = snapshot.data!; return ListView.builder( itemCount: trips.length, itemBuilder: ((context,…

VIEW QUESTION
Back To Top
Search