W3cubDocs

/Dart 2

fuse<T> method

Converter<Object, T> fuse <T>(Converter<String, T> other)
override

Fuses this with other.

Encoding with the resulting converter is equivalent to converting with this before converting with other.

Implementation

Converter<Object, T> fuse<T>(Converter<String, T> other) {
  if (other is Utf8Encoder && T is List<int>) {
    // The instance check guarantees that `T` is (a subtype of) List<int>,
    // but the static type system doesn't know that, and so we cast.
    // Cast through dynamic to keep the cast implicit for builds using
    // unchecked implicit casts.
    return JsonUtf8Encoder(indent, _toEncodable) as dynamic;
  }
  return super.fuse<T>(other);
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-convert/JsonEncoder/fuse.html