TokensInfo.fromJson constructor

TokensInfo.fromJson(
  1. Object? j
)

Implementation

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