getBySource method Null safety

OwnershipModel? getBySource(
  1. String source,
  2. String origin
)

Gets the OwnershipModel for source and origin in database.

Implementation

OwnershipModel? getBySource(String source, String origin) {
  List params = [source, origin];
  String where = "WHERE $columnSource = ? AND $columnOrigin = ?";
  List<OwnershipModel> ownerships = _select(whereStmt: where, params: params);
  return ownerships.isNotEmpty ? ownerships.first : null;
}