Flutter 3.47 Widget Previewer: Avoiding Common Failure ModesFlutter 3.47 Widget Previewer: Avoiding Common Failure Modes
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started
Flutter 3.47 made the Widget Previewer stable, and the first thing most teams will do is point it at a screen that boots the app. That one renders an error, not a component.
āš ļø š–š”š² š¢š­ šŸššš¢š„š¬: the previewer runs browser-backed. Native plugins, dart:io and dart:ffi are unsupported, and changing global state needs a full restart.
I've stopped reading those errors as tooling gaps. A widget that reads an injected value previews fine, because you can put a hand-written fake above it. One that builds its own dependency cannot.
šŸ” š“š”š«šžšž šœš”šžšœš¤š¬ before you annotate anything
Does it initialize a service on the way to the first frame? Move that to the composition root.
Does the constructor require arguments? Annotate a top-level factory function instead.
Does it have an intrinsic size? If not it auto-constrains to about half the preview frame, so pass size.
āœ… š’š­š¢š„š„ š§šØš­ šš š­šžš¬š­. A preview asserts nothing and never runs in CI. Keep the golden test for the dependency bump that shifts your card padding at 03:00.
Six failure modes, and the conventions that survive a design system. https://www.duskolicanin.com/blog/flutter-widget-previews-3-47-guide
Post image
Back to feed
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started