getById method

Future<T?> getById(
  1. String tableName,
  2. int id,
  3. FromMap<T> fromMap
)

Implementation

Future<T?> getById(String tableName, int id, FromMap<T> fromMap) async {
  final result =
      await database!.query(tableName, where: 'id = ?', whereArgs: [id]);
  if (result.isNotEmpty) {
    return fromMap(result.first);
  }
  return null;
}