fetchAnalyticsConfig method

  1. @override
Future<bool> fetchAnalyticsConfig()
override

Implementation

@override
Future<bool> fetchAnalyticsConfig() async {
  try {
    final response = await http.get(
      Uri.parse('${UrlConstants.apiService}/getAnalyticsConfig'),
      headers: _headers,
    );
    final json = jsonDecode(response.body) as Map<String, dynamic>;
    final enabled = json['isAnalyticsEnabled'] as bool?;
    _core.logger.i('[$runtimeType] fetch result $enabled');
    return enabled ?? false;
  } catch (e, s) {
    _core.logger.e('[$runtimeType] fetch error', error: e, stackTrace: s);
    return false;
  }
}