Skip to content

Instantly share code, notes, and snippets.

@Norbert515
Created February 20, 2018 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Norbert515/27c60fb8b69c16157a27db7618d74c82 to your computer and use it in GitHub Desktop.
Save Norbert515/27c60fb8b69c16157a27db7618d74c82 to your computer and use it in GitHub Desktop.
getBook
/// Get a book by its id, if there is not entry for that ID, returns null.
Future<Book> getBook(String id) async{
var result = await db.rawQuery('SELECT * FROM $tableName WHERE ${Book.db_id} = "$id"');
if(result.length == 0)return null;
return new Book.fromMap(result[0]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment