Skip to content
pubscout

code_editor

3.0.0, released 3 weeks ago by sciencesky.fr

A Flutter code editor widget with syntax highlighting, custom themes, and file navigation.

WASM-ready
$ flutter pub add code_editor
Source repository

What it does

Provides a multi-file code editor widget for Flutter with syntax highlighting via flutter_highlight, custom themes, undo/redo options, and text formatters.

AI-written summary of version 3.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to allow users to view and edit source code (dart, js, html, css, etc.) within a mobile or desktop app.
  • You need a ready-made code editor component with built-in syntax highlighting and file navigation tabs.

Skip it when

  • You are building a dedicated desktop/web-only IDE where advanced platform-specific code editing features are critical.
  • You require complex code completion (IntelliSense), find-and-replace, or deep text-mate grammar integrations.

Strengths

  • Supports multiple files with a built-in navigation bar and individual readonly configurations.
  • Customizable styling including font sizes, custom themes, undo/redo buttons, and button positioning.

Weaknesses

  • Primarily designed to make it easier to write code on mobile, lacking advanced features expected on desktop/web IDEs.
  • Requires wrapping in a SingleChildScrollView to avoid layout overflows from phone keypads.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
2

No native setup required. Just add the dependency to pubspec.yaml.

EditorModel model = EditorModel(
  files: [
    FileEditor(
      name: "page1.html",
      language: "html",
      code: "<h1>Hello World</h1>",
    ),
  ],
);

CodeEditor(
  model: model,
)

Alternatives

Packages that do the same job and could replace code_editor.

  • val_highlight_flutter

    Flutter widgets for displaying and editing syntax-highlighted code.

  • re_editor

    A lightweight text and code editor widget for Flutter with syntax highlighting and folding.

  • code_forge

    A powerful text editor widget for Flutter handling 1M+ lines with LSP and AI completion.

  • shiki_flutter

    TextMate-grammar based syntax highlighter for Flutter ported from Shiki.

Works with

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