Hi, thank you!

Yes, ProcessingState is a generic class that is used throughout the code. Its implementation looks like this:

```

/// Common processing states for fetching/posting data.

@freezed

class ProcessingState<ERROR, RESULT> with _$ProcessingState<ERROR, RESULT> {

const factory ProcessingState.standBy() = ProcessingStateStandBy;

const factory ProcessingState.loading() = ProcessingStateLoading;

const factory ProcessingState.error(ERROR e) = ProcessingStateError;

const factory ProcessingState.success(RESULT r) = ProcessingStateSuccess;

const ProcessingState._();

bool get isLoading => maybeMap(loading: T, orElse: F);

}

```

`_triggerUpdateSuccess` just returns another stream of states – error with a description and then immediately initial (standby) state. BlocListener listens to the error state and displays the error dialog, and returning to the initial state immediately (instead of staying in the same error state) shows explicitly that it's one-off event, we don't need to keep error state for a long time.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Kirill Bubochkin
Kirill Bubochkin

No responses yet

Write a response