methodString property
String
get
methodString
Implementation
String get methodString {
if (!generate) {
return '// generation skipped for method: $originalName cause no process name provided and method name not starts with _\n';
} else {
final processImplementation =
(String toStream, String generatorType) => '''
// annotated element: $originalName generator: $generatorType
Future<$stateType> $processName$methodParametersString async {
return executeMethod($toStream,'$originalName',);
}
''';
return returnTypeSwitch(
stateType,
element,
same: () => processImplementation(
'() => Future.value($callString).asStream()',
'stateType',
),
stream: () => processImplementation(
'() => $callString',
'Stream<stateType>',
),
future: () => processImplementation(
'() => $callString.asStream()',
'Future<stateType>',
),
futureOr: () => processImplementation(
'() async *{yield (await $callString);}',
'FutureOr<stateType>',
),
orElse: () => throw 'unsuported return type',
);
}
}