Config.fromJson constructor

Config.fromJson(
  1. Map<String, dynamic> json
)

Creates the configuration from a json map.

Allows for easy parsing when fetching the config from a remote location.

References

Implementation

Config.fromJson(Map<String, dynamic> json)
    : this(
        enabled: json['enabled'],
        uiElementSize: json['uiElementSize'].toDouble(),
        disabledRoutes: json['disabledRoutes'] != null
            ? (json['disabledRoutes'] as List).map((e) => e as String).toSet()
            : null,
        maxSessionIdleTime: json['session']?['maxIdleTime'],
        minSessionEventCount: json['session']?['minEventCount'],
        outputTypes: json['outputTypes'] != null
            ? filterNotNull(EnumToString.fromList(
                    OutputType.values, json['outputTypes']))
                .toSet()
            : null,
        heatMapStyle: json['heatMap']?['style'] != null
            ? EnumToString.fromString(
                HeatMapStyle.values, json['heatMap']?['style'])
            : null,
        heatMapTransparency: json['heatMap']?['transparency'].toDouble(),
        heatMapPixelRatio: json['heatMap']?['pixelRatio'].toDouble(),
      );