import 'bloc.dart'; // --- a freezed-style union -------------------------------------------------- // // freezed declares variants as redirecting factories on the base, and the bloc // emits through them: `emit(const DocState.loading())` builds a DocLoading. // Recording the base type (`DocState`) meant no emission ever matched a variant, // so every variant the UI renders was reported as never emitted. The variant // classes are written by hand here, as the generated file would declare them, // because this fixture has no dependencies and no codegen. class DocEvent {} sealed class DocState { const DocState(); const factory DocState.loading() = DocLoading; const factory DocState.ready() = DocReady; /// Declared, rendered, and never emitted: the positive control that proves /// redirect resolution did not simply suppress the rule. const factory DocState.stale() = DocStale; } class DocLoading extends DocState { const DocLoading(); } class DocReady extends DocState { const DocReady(); } class DocStale extends DocState { const DocStale(); } class DocBloc extends Bloc { DocBloc() : super(const DocState.loading()); void load() => emit(const DocState.ready()); }