Skip to content

type 'List<dynamic>' is not a subtype of type 'List<int>' in type cast #652

Closed
@SaadArdati

Description

@SaadArdati
      waveform: $checkedConvert(json, 'waveform',
          (v) => const ByteArrayJsonConverter().fromJson(v as List<int>)),
class ByteArrayJsonConverter implements JsonConverter<Uint8List, List<int>> {
  const ByteArrayJsonConverter();

  @override
  Uint8List fromJson(List<int> json) => Uint8List.fromList(json);

  @override
  List<int> toJson(Uint8List list) => list == null ? [] : List<int>.from(list);
}
CheckedFromJsonException
Could not create `FullTrack`.
There is a problem with "waveform".
type 'List<dynamic>' is not a subtype of type 'List<int>' in type cast

This is the manual fix:

      waveform: $checkedConvert(
          json, 'waveform', (v) => const ByteArrayJsonConverter().fromJson((v as List<dynamic>).cast<int>())),

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions