getRoleById method
Implementation
Future<Role> getRoleById(int id) async {
final Database db = await database;
List<Map<String, dynamic>> maps = await db.query(
'roles',
where: 'id = ?',
whereArgs: [id],
);
if (maps.isEmpty) {
return Role(title: "Not found", isEnable: 0); //
}
return Role(
id: maps[0]['id'],
title: maps[0]['title'],
isEnable: maps[0]['isEnable'],
);
}