AppIntentsHarness constructor

AppIntentsHarness({
  1. AppIntentsManifest? manifest,
  2. bool validateParams = true,
  3. Duration handlerRegistrationTimeout = Duration.zero,
  4. FutureOr<Object?> onRequestValue(
    1. String executionId,
    2. String parameter
    )?,
})

Installs a fresh plugin instance as AppIntentsPlatform.instance.

Register handlers after constructing the harness: registrations made on the previous instance do not carry over. Call dispose in tearDown to put the previous instance back.

manifest is optional. With it, list reports declared intents that have no handler and run validates params against the declared schema before the call; set validateParams to false to send malformed params on purpose.

handlerRegistrationTimeout is how long run waits for a handler that is not registered yet. A device waits 5 seconds for a cold start; the harness defaults to zero, so a missing handler fails at once with handlerNotFound.

Implementation

AppIntentsHarness({
  this.manifest,
  this.validateParams = true,
  Duration handlerRegistrationTimeout = Duration.zero,
  this.onRequestValue,
}) : _previous = AppIntentsPlatform.instance {
  _platform = _HarnessPlatform(this)
    ..handlerRegistrationTimeout = handlerRegistrationTimeout;
  AppIntentsPlatform.instance = _platform;
}