How to have entry variable in a stateful widget?

I’m just beginning to use firestore, and in the same time learning to use flutter and dart. I have two widgets : a stateless one and a stateful one, both returning the age of a user in a collection ‘users’. The stateless one has the user id as argument, but cannot handle real time changes.… Read More How to have entry variable in a stateful widget?

Field '_areas' should be initialized because its type 'List<Area>' doesn't allow null

Flutter shows error Non-nullable instance field ‘_areas’ must be initialized. Maybe this is because of not defining null in lists areas what when defining null Like List? _areas; it shows an error on the index Error: Field ‘_areas’ should be initialized because its type ‘List’ doesn’t allow null. Error Line: List _areas; Here is my… Read More Field '_areas' should be initialized because its type 'List<Area>' doesn't allow null

How to Create a Progress Indicator for WebView in Flutter

import ‘package:flutter/material.dart’; import ‘package:webview_flutter/webview_flutter.dart’; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( body: WebViewClass() ) ); } } class WebViewClass extends StatefulWidget { WebViewState createState() => WebViewState(); } class WebViewState extends State<WebViewClass>{ num position = 1 ; final key = UniqueKey(); doneLoading(String A) { setState(()… Read More How to Create a Progress Indicator for WebView in Flutter

error: The function can't be unconditionally invoked because it can be 'null'. with flutter

import ‘package:firebase_auth/firebase_auth.dart’; import ‘package:flutter/material.dart’; import ‘package:ourchat/screens/home/chat_screen.dart’; import ‘package:ourchat/screens/welcome/welcome_screen.dart’; class LandingPage extends StatefulWidget{ @override State<LandingPage> createState() => _LandingPageState(); } class _LandingPageState extends State<LandingPage>{ late User _user; @override void initState(){ // TODO: implement initState super.initState(); _checkUser(); } @override Widget build(BuildContext context) { if(_user == null){ return WelcomeScreen(); }else{ return HomePage(); } } Future<void> _checkUser() async{ _user =… Read More error: The function can't be unconditionally invoked because it can be 'null'. with flutter

StatefulWidget (setState not work did't show )

import ‘package:flutter/material.dart’; class CounterScreen extends StatefulWidget { const CounterScreen({Key? key}) : super(key: key); @override State<CounterScreen> createState() { return _CounterScreenState(); } } class _CounterScreenState extends State<CounterScreen> { int number=1; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( "Counter" ), ), body: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ TextButton(onPressed: (){ number–;} , child:… Read More StatefulWidget (setState not work did't show )

Flutter Listview.Builder inside bottom sheet widget not loading data on load

The below code does not display any data when the bottomsheet loads. Once the bottomsheet is loaded if I do a save operation on the code editor it loads the data. What am I missing here? I have a bottomsheet widget which is invoked using a button. _showBottomSheet() { showModalBottomSheet( context: context, builder: (context) {… Read More Flutter Listview.Builder inside bottom sheet widget not loading data on load

Multiple cards inside a list widget in flutter

I am a beginner in Flutter and i am creating an demo application but in that application I want to add another card in the list widget(code is mentioned below) but somehow it shows an error. import ‘package:flutter/cupertino.dart’; import ‘package:flutter/material.dart’; class Intro extends StatefulWidget { const Intro({Key? key}) : super(key: key); @override _IntroState createState() =>… Read More Multiple cards inside a list widget in flutter