State constructor

State(
  1. Map data
)

Implementation

State(Map data)
    :
      // flatten compound state for backward compatibility
      super(
          geolocation: (data['geolocation'] is Map)
              ? GeoConfig.fromMap(
                  (data['geolocation'] as Map).cast<String, dynamic>())
              : null,
          app: (data['app'] is Map)
              ? AppConfig.fromMap(
                  (data['app'] as Map).cast<String, dynamic>())
              : null,
          http: (data['http'] is Map)
              ? HttpConfig.fromMap(
                  (data['http'] as Map).cast<String, dynamic>())
              : null,
          activity: (data['activity'] is Map)
              ? ActivityConfig.fromMap(
                  (data['activity'] as Map).cast<String, dynamic>())
              : null,
          persistence: (data['persistence'] is Map)
              ? PersistenceConfig.fromMap(
                  (data['persistence'] as Map).cast<String, dynamic>())
              : null,
          logger: (data['logger'] is Map)
              ? LoggerConfig.fromMap(
                  (data['logger'] as Map).cast<String, dynamic>())
              : null,
          desiredAccuracy:
              _ensureInt((_flattenCompoundState(data))['desiredAccuracy']),
          distanceFilter:
              _ensureDouble((_flattenCompoundState(data))['distanceFilter']),
          stationaryRadius: _ensureDouble(
              (_flattenCompoundState(data))['stationaryRadius']),
          locationTimeout:
              _ensureInt((_flattenCompoundState(data))['locationTimeout']),
          disableElasticity:
              _ensureBool((_flattenCompoundState(data))['disableElasticity']),
          elasticityMultiplier: _ensureDouble(
              (_flattenCompoundState(data))['elasticityMultiplier']),
          stopAfterElapsedMinutes: _ensureInt(
              (_flattenCompoundState(data))['stopAfterElapsedMinutes']),
          geofenceProximityRadius: _ensureInt((_flattenCompoundState(data))['geofenceProximityRadius']),
          maxMonitoredGeofences: _ensureInt((_flattenCompoundState(data))['maxMonitoredGeofences']),
          geofenceInitialTriggerEntry: _ensureBool((_flattenCompoundState(data))['geofenceInitialTriggerEntry']),
          desiredOdometerAccuracy: _ensureDouble((_flattenCompoundState(data))['desiredOdometerAccuracy']),
          useSignificantChangesOnly: _ensureBool((_flattenCompoundState(data))['useSignificantChangesOnly']),
          disableLocationAuthorizationAlert: _ensureBool((_flattenCompoundState(data))['disableLocationAuthorizationAlert']),
          showsBackgroundLocationIndicator: _ensureBool((_flattenCompoundState(data))['showsBackgroundLocationIndicator']),
          enableTimestampMeta: _ensureBool((_flattenCompoundState(data))['enableTimestampMeta']),
          // Android Options
          geofenceModeHighAccuracy: (_flattenCompoundState(data))['geofenceModeHighAccuracy'],
          // ActivityRecognition
          isMoving: _ensureBool((_flattenCompoundState(data))['isMoving']),
          stopTimeout: _ensureInt((_flattenCompoundState(data))['stopTimeout']),
          activityRecognitionInterval: _ensureInt((_flattenCompoundState(data))['activityRecognitionInterval']),
          minimumActivityRecognitionConfidence: (_flattenCompoundState(data))['minimumActivityRecognitionConfidence'],
          disableStopDetection: _ensureBool((_flattenCompoundState(data))['disableStopDetection']),
          stopOnStationary: _ensureBool((_flattenCompoundState(data))['stopOnStationary']),
          // HTTP & Persistence
          url: (_flattenCompoundState(data))['url'],
          persistMode: (_flattenCompoundState(data))['persistMode'],
          method: (_flattenCompoundState(data))['method'],
          httpRootProperty: (_flattenCompoundState(data))['httpRootProperty'],
          params: (_flattenCompoundState(data))['params'].cast<String, dynamic>(),
          headers: (_flattenCompoundState(data))['headers'].cast<String, dynamic>(),
          extras: (_flattenCompoundState(data))['extras'].cast<String, dynamic>(),
          autoSync: _ensureBool((_flattenCompoundState(data))['autoSync']),
          autoSyncThreshold: (_flattenCompoundState(data))['autoSyncThreshold'],
          disableAutoSyncOnCellular: _ensureBool((_flattenCompoundState(data))['disableAutoSyncOnCellular']),
          disableProviderChangeRecord: _ensureBool((_flattenCompoundState(data))['disableProviderChangeRecord']),
          batchSync: _ensureBool((_flattenCompoundState(data))['batchSync']),
          maxBatchSize: (_flattenCompoundState(data))['maxBatchSize'],
          locationTemplate: (_flattenCompoundState(data))['locationTemplate'],
          geofenceTemplate: (_flattenCompoundState(data))['geofenceTemplate'],
          maxDaysToPersist: (_flattenCompoundState(data))['maxDaysToPersist'],
          maxRecordsToPersist: (_flattenCompoundState(data))['maxRecordsToPersist'],
          locationsOrderDirection: (_flattenCompoundState(data))['locationsOrderDirection'],
          httpTimeout: (_flattenCompoundState(data))['httpTimeout'],
          authorization: ((_flattenCompoundState(data))['authorization'] != null) ? Authorization.fromMap((_flattenCompoundState(data))['authorization']) : null,
          // Application
          stopOnTerminate: _ensureBool((_flattenCompoundState(data))['stopOnTerminate']),
          startOnBoot: _ensureBool((_flattenCompoundState(data))['startOnBoot']),
          heartbeatInterval: _ensureInt((_flattenCompoundState(data))['heartbeatInterval']),
          schedule: (_flattenCompoundState(data))['schedule'].cast<String>(),
          // Logging & Debug
          debug: _ensureBool((_flattenCompoundState(data))['debug']),
          logLevel: (_flattenCompoundState(data))['logLevel'],
          logMaxDays: (_flattenCompoundState(data))['logMaxDays'],
          ////
          // iOS Options
          //

          // Geolocation Options
          pausesLocationUpdatesAutomatically: _ensureBool((_flattenCompoundState(data))['pausesLocationUpdatesAutomatically']),
          locationAuthorizationRequest: (_flattenCompoundState(data))['locationAuthorizationRequest'],
          locationAuthorizationAlert: ((_flattenCompoundState(data))['locationAuthorizationAlert'] != null) ? (_flattenCompoundState(data))['locationAuthorizationAlert'].cast<String, dynamic>() : null,
          // Activity Recognition Options
          activityType: (_flattenCompoundState(data))['activityType'],
          stopDetectionDelay: _ensureInt((_flattenCompoundState(data))['stopDetectionDelay']),
          disableMotionActivityUpdates: _ensureBool((_flattenCompoundState(data))['disableMotionActivityUpdates']),
          // Application Options
          preventSuspend: _ensureBool((_flattenCompoundState(data))['preventSuspend']),
          ////
          // Android Options
          //

          // Geolocation Options
          locationUpdateInterval: (_flattenCompoundState(data))['locationUpdateInterval'],
          fastestLocationUpdateInterval: (_flattenCompoundState(data))['fastestLocationUpdateInterval'],
          deferTime: (_flattenCompoundState(data))['deferTime'],
          allowIdenticalLocations: (_flattenCompoundState(data))['allowIdenticalLocations'],
          speedJumpFilter: (_flattenCompoundState(data))['speedJumpFilter'],
          // Activity Recognition Options
          triggerActivities: (_flattenCompoundState(data))['triggerActivities'],
          motionTriggerDelay: (_flattenCompoundState(data))['motionTriggerDelay'],
          // Application Options
          enableHeadless: (_flattenCompoundState(data))['enableHeadless'],
          scheduleUseAlarmManager: ((_flattenCompoundState(data))['scheduleUseAlarmManager'] != null) ? (_flattenCompoundState(data))['scheduleUseAlarmManager'] : false,
          backgroundPermissionRationale: ((_flattenCompoundState(data))['backgroundPermissionRationale'] != null) ? PermissionRationale.fromMap((_flattenCompoundState(data))['backgroundPermissionRationale']) : null,
          notification: ((_flattenCompoundState(data))['notification'] != null) ? Notification.fromMap((_flattenCompoundState(data))['notification']) : null) {
  final Map flat = _flattenCompoundState(data);
  enabled = _ensureBool(flat['enabled'])!;
  isFirstBoot = _ensureBool(flat['isFirstBoot'])!;
  trackingMode = flat['trackingMode'];
  schedulerEnabled = _ensureBool(flat['schedulerEnabled'])!;
  odometer = _ensureDouble(flat['odometer'])!;
  didLaunchInBackground = (flat['didLaunchInBackground'] != null)
      ? _ensureBool(flat['didLaunchInBackground'])!
      : false;
  didDeviceReboot = (flat['didDeviceReboot'] != null)
      ? _ensureBool(flat['didDeviceReboot'])!
      : false;
  map = flat;
}