getByOwnershipId method Null safety

ConsentModel? getByOwnershipId(
  1. Uint8List ownershipId
)

Gets the latest ConsentModel for an ownershipId.

Implementation

ConsentModel? getByOwnershipId(Uint8List ownershipId) {
  String where = '''WHERE $columnOwnershipId =
    x'${Bytes.hexEncode(ownershipId)}' ORDER BY $table.oid DESC LIMIT 1''';
  List<ConsentModel> consents = _select(whereStmt: where, params: []);
  return consents.isNotEmpty ? consents.first : null;
}