fromJsonOrNull static method

DataRefModel? fromJsonOrNull(
  1. Map<String, dynamic>? otherData
)

Implementation

static DataRefModel? fromJsonOrNull(
  Map<String, dynamic>? otherData,
) {
  try {
    final id = otherData?['id']?.toString().trim().nullIfEmpty;
    final collection = letList(otherData?['collection'])
        ?.map(
          (p0) => p0?.toString().trim().nullIfEmpty,
        )
        .nonNulls
        .nullIfEmpty
        ?.toList();
    return DataRefModel(
      id: id,
      collection: collection,
    );
  } catch (e) {
    return null;
  }
}