initializeCloud method

Future<void> initializeCloud({
  1. required MorphrCloudOptions options,
})

Implementation

Future<void> initializeCloud({required MorphrCloudOptions options}) async {
  _fileStorage = MorphrFileStorage(fileName: 'design.json');

  _cloud = MorphrCloud(options: options, fileStorage: _fileStorage!);

  await _cloud!.init();
  _isCloudEnabled = true;

  if (await _fileStorage!.exists()) {
    try {
      await _loadDocumentFromCloud();
      _syncCloudInBackground();
    } catch (e) {
      await syncCloud();
    }
  } else {
    await syncCloud();
  }
}