ApiConfig.fromJson constructor

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

Creates an ApiConfig instance from a JSON map.

This factory constructor parses a JSON map and creates a corresponding ApiConfig object. It expects the JSON map to contain the keys 'baseUrl' and 'timeout'.

Example JSON:

{
  "baseUrl": "[https://api.example.com](https://api.example.com)",
  "timeout": 10000
}

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

Implementation

factory ApiConfig.fromJson(Map<String, dynamic> json) {
  return ApiConfig(
    baseUrl: json['baseUrl'] as String,
    timeout: json['timeout'] as int,
  );
}