I'm making an edit profile page in my flutter app using laravel
as my database. I got an error saying that my boolean expression must not be null. How would I be able to solve this?
void _update()async {
setState(() {
_isLoading = true;
});
var userData;
var update = await Network().editData(userData, '/user Data');
var body = json.decode(update.body);
if(body['Done']){
SharedPreferences localStorage = await SharedPreferences.getInstance();
localStorage.setString('user Data', json.encode(body['user Data']));
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Profile()
),
);
}
setState(() {
_isLoading = false;
});
} }
Here is the stacktrace:
E/flutter (28905): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)]
Unhandled Exception: Failed assertion: boolean expression must not be null
E/flutter (28905): #0 _EditState._update (package:project1app/screen/editprofile.dart:264:12)