Mercury constructor

Mercury({
  1. Key? key,
  2. MercuryBundle? bundle,
  3. OnControllerCreated? onControllerCreated,
  4. LoadHandler? onLoad,
  5. MercuryMethodChannel? javaScriptChannel,
  6. DevToolsService? devToolsService,
  7. HttpClientInterceptor? httpClientInterceptor,
  8. UriParser? uriParser,
  9. LoadErrorHandler? onLoadError,
  10. JSErrorHandler? onJSError,
})

Implementation

Mercury({
    Key? key,
    this.bundle,
    this.onControllerCreated,
    this.onLoad,
    this.javaScriptChannel,
    this.devToolsService,
    // mercury's http client interceptor.
    this.httpClientInterceptor,
    this.uriParser,
    // Callback functions when loading Javascript scripts failed.
    this.onLoadError,
    this.onJSError
  }) {
    controller = MercuryController(shortHash(this),
      entrypoint: bundle,
      onLoad: onLoad,
      onLoadError: onLoadError,
      onJSError: onJSError,
      methodChannel: javaScriptChannel,
      devToolsService: devToolsService,
      httpClientInterceptor: httpClientInterceptor,
      uriParser: uriParser);

    if (onControllerCreated != null) {
      onControllerCreated!(controller!);
    }
}