deserializeAsync function

Future deserializeAsync(
  1. DeserializationMessage message
)

"Root" level function for use in an isolate.

Implementation

Future<dynamic> deserializeAsync(DeserializationMessage message) async {
  // Remove all spaces. Necessary for regular expressions as well.
  final targetType = message.targetType.replaceAll(' ', '');

  // If the expected target type is String, nothing to do...
  return targetType == 'String'
      ? message.json
      : MattermostApiClient._deserialize(
          jsonDecode(message.json),
          targetType,
          growable: message.growable,
        );
}