template property

  1. @override
String get template
override

Implementation

@override
String get template => '''
import 'package:afib/afib_flutter.dart';
$insertExtraImports
$insertMemberVariableImports

class $insertQueryType extends AFIsolateListenerQuery<$insertResultType> {
// AFib Help:
// Be careful about what members variables you place in here.  If they are
// not serializable (according to Flutter's internal ability to serialize data,
// see the isolate docs), you will get strange compiler errors.  Basically,
// to create the isolate, Flutter has to make a copy of your member variables
// using its own serialization mechanism.
$insertMemberVariables


$insertQueryType({
  AFID? id,
  $insertConstructorParams
  AFOnResponseDelegate<$insertResultType>? onSuccess,
  AFOnErrorDelegate? onError,
  AFPreExecuteResponseDelegate<$insertResultType>? onPreExecuteResponse
}): super(
  id: id,
  $insertSuperParams,
  onSuccess: onSuccess,
  onError: onError,
  onPreExecuteResponse: onPreExecuteResponse,
);

@override
void executeInIsolate(AFIsolateListenerExecutionContext<$insertResultType> context) async {
  // AFib Help:
  // Put the code that actually implements the thread logic here, then, use
  // context.executeSendMessage($insertResultType), to send results back to your main thread.
  // Again, $insertResultType must be serializable according to flutter, because Flutter
  // copies the memory to the main threads space.
  //
  // Here, you intentionally cannot manipulate the UI or state directly via the context.   You
  // are not in the correct thread/memory space to do that.
  $insertStartImpl
}

@override
void finishAsyncWithResponse(AFFinishQuerySuccessContext<$insertResultType> context) {
  // AFib Help:
  // This is where you can process results from the threads context.executeSendMessage call
  // on the main UI thread.   Here, you can update the state/UI as you normally would, as this
  // method executes in the correct memory space.
  $insertFinishImpl
}

$insertAdditionalMethods
}
''';