freezed declares variants as redirecting factories on the base (`const factory DocState.loading() = DocLoading;`) and blocs emit through them. `emit(const DocState.loading())` was recorded as emitting `DocState`, which is never a variant, so no freezed emission matched and every variant the UI renders was reported by rendered-not-emitted as a dead branch. Factory redirects are now also kept by constructor name, and an instance creation of `Type.ctor` (or an unnamed redirecting factory) is credited to the class it redirects to, for emissions, `state =` assignments and dispatches alike. Reproduced on freezed_style.dart before the fix: DocLoading, DocReady and DocStale all reported as never emitted; after, only DocStale, which really is never emitted and stays as the positive control. No change on nuwayze, tick, dex or word_alive.
17 lines
442 B
Dart
17 lines
442 B
Dart
// UI for freezed_style.dart, kept in its own file because type tests in a file
|
|
// that declares a bloc do not count as UI.
|
|
|
|
import 'bloc.dart';
|
|
import 'freezed_style.dart';
|
|
|
|
class DocView {
|
|
const DocView();
|
|
|
|
Object build() => BlocBuilder<DocBloc, DocState>(
|
|
builder: (context, state) => switch (state) {
|
|
DocLoading() => 'loading',
|
|
DocReady() => 'ready',
|
|
DocStale() => 'stale',
|
|
},
|
|
);
|
|
}
|