ListModelsResponse.fromJson constructor

ListModelsResponse.fromJson(
  1. Object? j
)

Implementation

factory ListModelsResponse.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return ListModelsResponse(
    models: switch (json['models']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Model.fromJson(i)],
      _ => throw const FormatException('"models" is not a list'),
    },
    nextPageToken: switch (json['nextPageToken']) {
      null => '',
      Object $1 => decodeString($1),
    },
  );
}