Reputation: 172
Well I want to return a true state when the username and password match but here's the code
dataBaseHelper.getUserList().then((value) => {
for(User userOB in value){
if(userName == userOB.username && password == userOB.password){
return true
}
}
});
I cannot return inside the .then((value) =>{
}) why? I'm new to flutter BTW
Upvotes: 1
Views: 127
Reputation: 368
You can try using async await
instead of then()
var value = await dataBaseHelper.getUserList();
for(User userOB in value){
if(userName == userOB.username && password == userOB.password){
return true;
}
}
Upvotes: 3