data property

Access to the current state's data.

Throws an exception if not initialized.

Implementation

DevicePreviewData get data => state.maybeMap(
      initialized: (state) => state.data,
      orElse: () => throw Exception('Not initialized'),
    );
void data=(DevicePreviewData data)

Defines the current state's data.

Throws an exception if not initialized.

Implementation

set data(DevicePreviewData data) {
  state = state.maybeMap(
    initialized: (state) {
      final result = state.copyWith(data: data);
      unawaited(storage.save(data));
      return result;
    },
    orElse: () => throw Exception('Not initialized'),
  );
}