Skip to content
pubscout

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.

$ flutter pub add widget_with_codeview
Source repository

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.

Works with

Packages commonly used together with widget_with_codeview: ones it builds on, ones built on it, and its own family.