getSnapshotState method

  1. @override
Future getSnapshotState()
inherited

Get the current state for snapshot creation

Implementation

@override
Future<dynamic> getSnapshotState() async {
  if (!isInitialized) {
    return null;
  }

  // Check if state supports snapshots
  if (currentState is SnapshotableState) {
    final snapshotableState = currentState as SnapshotableState;
    if (snapshotableState.shouldSnapshot) {
      return snapshotableState.createSnapshot();
    }
  }

  // Default: serialize state to map
  return currentState.toMap();
}