initializeStorage function

Future<void> initializeStorage()

Initializes the storage with the required fields.

Implementation

Future<void> initializeStorage() async {
  try {
    final prefs = await SharedPreferences.getInstance();
    final isInitialized = prefs.getBool('isInitialized');
    if (isInitialized == null || isInitialized == false) {
      await prefs.setBool('isInitialized', true);
      await prefs.setString('sgm_config',
          '{"apiKey": "", "dataCenterUrl": "", "subDomain": "", "dataCenterPushUrl": "", "isApnsEnabled": false}');
      await prefs.setString('deviceInformation',
          '{"deviceName": "", "deviceType": "", "appVersion": ""}');
      await prefs.setString('sgm_user', '{"userId": "", "sessionId": ""}');
    }
  } catch (e) {
    throw Exception('initializeStorage error: $e');
  }
}