decode method

  1. @override
Future<T?> decode(
  1. PlatformDataProvider dataProvider,
  2. PlatformFormat format
)
override

Decodes the data from platform representation. Returns null if decoding failed.

Important: When implementing custom decoder it is necessary to request all data from dataProvider before awaiting on anything. Default implementation simply attempts to cast to target format.

Implementation

@override
Future<T?> decode(
    PlatformDataProvider dataProvider, PlatformFormat format) async {
  return onDecode != null
      ? onDecode!(dataProvider, format)
      : super.decode(dataProvider, format);
}