findById method

Future<UserModel?> findById(
  1. {required int id}
)

Get user by ID

Implementation

Future<UserModel?> findById({
  required int id,
}) async {
  try {
    return await (_db.select(_db.users)..where((tbl) => tbl.id.equals(id)))
        .getSingle();
  } catch (e) {
    return null;
  }
}