startAsync method

  1. @override
void startAsync(
  1. AFStartQueryContext<AFAppPlatformInfoState> context
)
override

Called at the start of an asynchronous process, starts the query using data from the command.

The implementation should call either AFStartQueryContext.onSuccess or AFStartQueryContext.onError, which will in turn call finishAsyncWithResponse or finishAsyncWithError.

Implementation

@override
void startAsync(AFStartQueryContext<AFAppPlatformInfoState> context) {
  PackageInfo.fromPlatform().then((packageInfo) {
    final result = AFAppPlatformInfoState(
      appName: packageInfo.appName,
      packageName: packageInfo.packageName,
      appVersion: packageInfo.version,
      appBuildNumber: packageInfo.buildNumber,
      os: Platform.operatingSystem,
      osVersion: Platform.operatingSystemVersion,
      screenSize: "",
    );
    context.onSuccess(result);
  });
}