getConfig method

Future<(HaConfig?, HaFailure?)> getConfig()

Returns the current configuration as JSON.

Implementation

Future<(HaConfig?, HaFailure?)> getConfig() async {
  const endpoint = '/api/config';
  final response = await sl.get<HttpClient>().get(url + endpoint, _headers);
  return response.success
      ? (HaConfig.fromJson(jsonDecode(response.dataStr)), null)
      : (null, HaFailure(message: response.dataStr));
}