MagicPreview class final
The dev-only preview registration entrypoint.
The generated _previews.g.dart (Step 18) returns a List<PreviewEntry>
from a FUNCTION and feeds it here:
// lib/_previews.g.dart (generated)
List<PreviewEntry> previewEntries() => <PreviewEntry>[ ... ];
// RouteServiceProvider.boot()
MagicPreview.register(previewEntries());
MagicPreview.registerRoutes();
Entries are held in a function-scoped static list (never a top-level const holding widget refs — the dart-lang/sdk#33920 foot-gun), assigned only from register, so the release-mode tree-shaker can prove them unreachable once registerRoutes folds dead behind kReleaseMode + kPreviewEnabled.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
entries
→ List<
PreviewEntry> -
The currently registered previews (read-only view).
no setter
Static Methods
-
register(
List< PreviewEntry> entries) → void -
Register the catalog
entries. -
registerRoutes(
) → void -
Register the
/previewcatalog page and its/preview/:componentdeep link. -
resetForTesting(
) → void - Test-only reset of the registered entries.