CollectionObject.fromJson constructor

CollectionObject.fromJson({
  1. required Map<String, dynamic> json,
})

Implementation

CollectionObject.fromJson({
  required final Map<String, dynamic> json,
})  : id = json[Constants.docId] as String,
      name = json['name'] as String,
      prjId = json[Constants.prjIdKey] as int,
      schema = EnumToString.fromString(
            CollectionSchema.values,
            json['schema'] as String? ?? 'public',
          ) ??
          CollectionSchema.public,
      role = EnumToString.fromString(
            CollectionRole.values,
            json['role'] as String? ?? 'nil',
          ) ??
          CollectionRole.nil,
      keys = json['keys'] != null
          ? List<String>.from(json['keys'] as List<dynamic>)
          : const <String>[];