fromJsonList static method

List<Variable> fromJsonList(
  1. List json
)

Implementation

static List<Variable> fromJsonList(List<dynamic> json) {
  final variables = json.map((e) => fromJson(e)).toList();
  if (variables.indexWhere((element) => element.id == 'ui_state') == -1) {
    variables.add(
      EnumVar(
        id: 'ui_state',
        name: 'UI State',
        isNullable: false,
        value: 'initial',
        values: [
          MapEntry(const Uuid().v1(), 'initial'),
          MapEntry(const Uuid().v1(), 'loading'),
          MapEntry(const Uuid().v1(), 'success'),
          MapEntry(const Uuid().v1(), 'error'),
        ],
      ),
    );
  }
  return variables;
}