WiredashAnalytics constructor

WiredashAnalytics({
  1. String? projectId,
  2. String? environment,
})

Creates a new instance of WiredashAnalytics, creating multiple is totally fine. The events are stored on disk and sent to the server in periodic intervals.

Set the projectId in case you have multiple Wiredash widgets with different projectIds in your app. If you only have one Wiredash widget, you can omit the projectId.

Set the environment of your app, like 'prod', 'dev', 'staging' Defaults to the environment of the Wiredash widget, which itself defaults to 'dev' for debug builds and 'prod' for release builds.

It is necessary to set the environment in cases when there is no Wiredash widget mounted, like in a background isolate.

Implementation

WiredashAnalytics({
  String? projectId,
  String? environment,
})  : _projectId = projectId,
      _environment = environment {
  if (environment != null) {
    validateEnvironment(environment);
  }
}