clearState method

Future<void> clearState(
  1. String type
)

Implementation

Future<void> clearState(String type) async {
  try {
    if (!_hasSyncData) {
      // Waiting to sync data from native platform
      await _syncSharedState;
    }

    // Clear local cached state for specified type
    _cachedSharedState[type] = null;
    // Notify state clear to registered listeners
    _notifyListeners(type, null);
    // Notify other flutter engine to clear state
    await methodChannel.invokeMethod('clearState', {'type': type});
  } on PlatformException catch (e) {
    debugPrint('Error clear shared state: ${e.message}');
  }
}