Model.fromJson constructor

Model.fromJson(
  1. Map json
)

Implementation

factory Model.fromJson(Map json) {
  return Model(
    name: json['name'],
    dbName: json['dbName'],
    fields: (json['fields'] as Iterable).map((e) => Field.fromJson(e)),
    uniqueIndexes: (json['uniqueIndexes'] as Iterable)
        .map((e) => UniqueIndex.fromJson(e)),
    documentation: json['documentation'],
    primaryKey: json['primaryKey'] == null
        ? null
        : PrimaryKey.fromJson(json['primaryKey']),
    isGenerated: switch (json['isGenerated']) {
      bool value => value,
      _ => false,
    },
  );
}