generate method

String generate()
inherited

Wraps fieldsForGenerator in a method to produce serialization or deserialization

Implementation

String generate() {
  final expectedOutput = doesDeserialize ? 'Future<$className>' : 'Future<$serializeOutputType>';
  final returnWrapper =
      doesDeserialize ? '$className($fieldsForGenerator)' : '{$fieldsForGenerator}';
  final output = '''
    $expectedOutput $serializingFunctionName($serializingFunctionArguments) async {
      return $returnWrapper$generateSuffix
    }
  ''';

  return _formatter.format(output);
}