Last active
January 16, 2019 21:10
-
-
Save ericgrandt/8f27c215287a7b526d82d78c90dc77f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newUser(User user) async { | |
final db = await database; | |
var res = await db.insert('user', user.toJson()); | |
return res; | |
} | |
getUser(int id) async { | |
final db = await database; | |
var res = await db.query('user', where: 'id = ?', whereArgs: [id]); | |
return res.isNotEmpty ? User.fromJson(res.first) : Null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment