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?;
    return enabled ?? false;
  } catch (e, s) {
    loggerService.instance.d(
      '[$runtimeType] fetch remote configuration error',
      error: e,
      stackTrace: s,
    );
    return false;
  }
}