fetchChartConfig method

Future<Map<String, dynamic>> fetchChartConfig()

Fetch the public dashboard branding config used to paint the loading screen before any authenticated call.

Public endpoint: sends no auth/token/session headers, only informative ones (see _publicHeaders).

Implementation

Future<Map<String, dynamic>> fetchChartConfig() async {
  final url = Uri.parse(
    '${config.baseUrl}/individuals/${config.sessionId}/config/chart',
  );

  final response = await _client.get(url, headers: _publicHeaders);

  if (response.statusCode != 200) {
    throw DataleonApiException(
      'Failed to fetch chart config',
      statusCode: response.statusCode,
    );
  }

  final body = jsonDecode(response.body);
  if (body is Map<String, dynamic>) return body;
  return const <String, dynamic>{};
}