fromJsonOrNull static method

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

Implementation

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