class _ProfilePageState extends State<ProfilePage> {
String tmpimage;
Uint8List TmpBytesImage;
File pimage;
void initState() {
super.initState();
Future.delayed(Duration.zero, () {
TmpBytesImage= profileimage();
});
}
profileimage() async {
var userimage1 = await DBHelper().getuserIMAGE1('roro');
print(userimage1);
if (userimage1 == Null) {
print('Empty');
} else {
setState(() {
userimage1.map((e) {
tmpimage = e['image0'];
}).toList();
print(tmpimage);
return Base64Decoder().convert(tmpimage);
});
}
}
The first error was:
Only static members can be accessed in initializers
I added :
void initState() {
super.initState();
Future.delayed(Duration.zero, () {
TmpBytesImage= profileimage();
});
}
Then it seemed to be working normally.
But there is a null value in the TmpBytesImage. How to fix it?