readCustomer method

Future<Customer?> readCustomer(
  1. int id
)

Implementation

Future<Customer?> readCustomer(int id) async {
  final db = await instance.database;
  final maps = await db.query(
    'customers',
    where: 'id = ?',
    whereArgs: [id],
  );

  if (maps.isNotEmpty) {
    return Customer.fromMap(maps.first);
  } else {
    return null;
  }
}