Answers for "The method '[]' can't be unconditionally invoked because the receiver can be 'null'"

1

The method '[]' can't be unconditionally invoked because the receiver can be 'null'

you can just add the type of the future you are using like this one

//this one wont work

body: FutureBuilder(
            future:getDataFromJason(),
            builder: (ctx, snapShot) {
              if(snapShot.connectionState==ConnectionState.waiting){
                return Center(child: CircularProgressIndicator());
              }
              else{}

//but this will just add the type of futureBuilder 

body: FutureBuilder<dynamic>(
            future:getDataFromJason(),
            builder: (ctx, snapShot) {
              if(snapShot.connectionState==ConnectionState.waiting){
                return Center(child: CircularProgressIndicator());
              }
              else{
Posted by: Guest on September-20-2021

Code answers related to "The method '[]' can't be unconditionally invoked because the receiver can be 'null'"

Browse Popular Code Answers by Language