widget_with_codeview
3.2.0, released 9 months ago by an unverified publisher
A widget that displays a widget alongside its source code side-by-side.
What it does
Wraps a Flutter widget to provide a side-by-side or tabbed view showing its actual implementation source code. It highlights syntax using flutter_highlight and can open code links in the browser.
AI-written summary of version 3.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- Building widget catalogs or tutorial apps where source code needs to be shown alongside UI examples.
- Showcasing component libraries with live code inspection.
Skip it when
- Standard production applications that do not need to expose source code to users.
- When source files cannot be embedded as assets in the app bundle.
Strengths
- Provides an easy way to display source code views next to running widgets.
- Supports custom themes for code highlighting and tab change listeners.
Weaknesses
- Requires manual addition of source code files to pubspec.yaml assets.
- Increases application bundle size by bundling source text as assets.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 6
Requires adding source code files to the assets section of pubspec.yaml.
WidgetWithCodeView(
child: MyAwesomeWidget(),
filePath: 'lib/my_awesome_source_code.dart',
codeLinkPrefix: 'https://github.com/<my_username>/<my_project>/blob/master/',
)Alternatives
Packages that do the same job and could replace widget_with_codeview.
- re_editor
A lightweight text and code editor widget for Flutter with syntax highlighting and folding.
80Compare - shiki_flutter
TextMate-grammar based syntax highlighter for Flutter ported from Shiki.
59Compare - dart_code_viewer2
A Flutter widget to view, theme, and copy Dart code snippets.
55Compare - tab_container
Customisable tab view and carousel widget with an animated indicator
50Compare
Works with
Packages commonly used together with widget_with_codeview: ones it builds on, ones built on it, and its own family.
- string_scannerwidget_with_codeview depends on itA class for parsing strings using a sequence of patterns.
- url_launcherwidget_with_codeview depends on itFlutter plugin for launching URLs across mobile, desktop, and web platforms.
- google_fontswidget_with_codeview depends on itFlutter package to load Google Fonts at runtime or bundle them as assets
- flutter_highlightwidget_with_codeview depends on itA Flutter widget that highlights source code with many languages and themes.
- flutter_speed_dialwidget_with_codeview depends on itFlutter plugin to implement a Material Design Speed Dial with labels and animated icons.
- selectablewidget_with_codeview depends on itA widget that enables text selection across multiple text widgets.