Reputation: 447
hello i get data in sqlite code :
getuserIDPW(String email) async{
final db = await database;
var res = await db.query("person",columns: ['email', 'password'] ,where: "email = ?", whereArgs: [email]);
return res.isNotEmpty? res : Null;
}
code :
var useridpw = await DBHelper().getuserIDPW(_email);
print(useridpw);
That's how I got the result of [{email: kmail, password: 123123}]
But i want String like this : var tmpEmail = 'kmail';
How to get String in map ?
I'd be grateful if someone would help me.
Upvotes: 0
Views: 88
Reputation: 409
You can use like below code if you want to get specific String :-
Future<String> getuserIDPW(String email) async{
final db = await database;
var res = await db.query("person",columns: ['email', 'password'] ,where: "email = ?", whereArgs: [email]);
return res.isNotEmpty? res[0][yourKey like 'email' OR 'password'] : Null;
}
Upvotes: 1
Reputation: 628
u can get you email by doing this :
first u have a list so u should map it
var email ;
useridpw.map((e) {
email = e['email'];
}).toList()
Upvotes: 1