decode<T> method
Decode bytes to generic typed object.
You need to pass constructor tearoffs
for your type in decoder
parameter.
https://github.com/dart-lang/language/blob/main/accepted/2.15/constructor-tearoffs/feature-specification.md
Example of using fromJson that accepts Map to constuct Person
instance:
Person personFromBytes = jsonMessageAdapter.decode(bytes, Person.fromJson);
Implementation
@override
T decode<T>(Uint8List bytes, dynamic decoder) => bytes as T;