AnalyticsConfig.fromJson constructor

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

Creates an AnalyticsConfig instance from a JSON map.

This factory constructor parses a JSON map and creates a corresponding AnalyticsConfig object. It expects the JSON map to contain the keys 'enableTracking', 'enableAnalytics', and 'apiKey'.

Example JSON:

{
  "enableTracking": true,
  "enableAnalytics": false,
  "apiKey": "your_api_key"
}

Throws a TypeError if the provided JSON values are not of the expected types.

Implementation

factory AnalyticsConfig.fromJson(Map<String, dynamic> json) {
  return AnalyticsConfig(
    enableTracking: json['enableTracking'] as bool,
    enableAnalytics: json['enableAnalytics'] as bool,
    apiKey: json['apiKey'] as String,
  );
}