toMap method

Map<String, Object?> toMap()

Throws an ArgumentError if a timeout is shorter than 1 second, which would otherwise start a new session with every event.

Implementation

Map<String, Object?> toMap() {
  _checkTimeout(foregroundTimeout, 'foregroundTimeout');
  _checkTimeout(backgroundTimeout, 'backgroundTimeout');
  final conf = <String, Object?>{
    'foregroundTimeout': foregroundTimeout?.inSeconds,
    'backgroundTimeout': backgroundTimeout?.inSeconds,
    'continueSessionOnRestart': continueSessionOnRestart
  };
  conf.removeWhere((key, value) => value == null);
  return conf;
}