re-editor is a free, open source ides & code editors project written in Dart and released under MIT. It has 762 GitHub stars, 101 forks and 39 open issues, and was last pushed 1 months ago. On this registry it ranks #22 of 22 tracked projects in IDEs & Code Editors, with 5 head-to-head comparisons available.

What is re-editor?

Re-Editor is an MIT-licensed, lightweight text and code editor widget for Flutter, published on pub.dev as the re_editor package, intended for Dart developers who need multi-line text display, syntax highlighting, and code-editor behaviour inside an application rather than a plain input field.

What it is

Re-Editor is a text and code editor widget written in Dart for the Flutter ecosystem, distributed through pub.dev as the re_editor package and developed as a module within the Reqable project. It is designed to work both as a simple text area and as the basis for a code editor with more complex functionality, and it is positioned explicitly against Flutter's default TextField, which is a general-purpose input control rather than a tool for multi-line text.

The concrete problem it addresses is that TextField is not tailored to the display and input of large multi-line text. Re-Editor is not a secondary encapsulation built on top of TextField; it independently implements layout, drawing, and event processing, and it is specifically optimised for large texts, offering high performance and resolving issues that arise with TextField. It also hands control back to the developer on decisions such as whether horizontal scrolling and word wrap are enabled, whether the editor is read-only, whether line numbers and content folding are shown, which shortcut keys apply, and which syntax highlighting rules are used.

Key capabilities

  • Two-way horizontal and vertical scrolling, configured through CodeScrollController with separate verticalScroller and horizontalScroller ScrollController instances.
  • Text syntax highlighting built on Re-Highlight, supporting nearly a hundred languages and theme styles, where CodeEditorStyle takes a CodeHighlightTheme mapping a language such as json to a mode such as langJson and a theme such as atomOneLightTheme.
  • Content collapsing and expanding, with DefaultCodeChunkAnalyzer automatically detecting fold regions for braces and brackets, NonCodeChunkAnalyzer available to switch detection off, and the CodeChunkAnalyzer interface open for custom rules.
  • Line numbers and fold markers assembled through the indicatorBuilder callback using DefaultCodeLineNumber and DefaultCodeChunkIndicator.
  • Search and replace control logic exposed through the findBuilder attribute, which lets a project supply its own search panel UI.
  • CodeLineEditingController as the editing controller, initialised for simple cases with CodeLineEditingController.fromText inside the CodeEditor widget.
  • Input hints and auto-completion, a custom context menu builder, smart input, configurable shortcut keys, and large text display and editing.

Who uses it and how

  • Flutter application developers who need a code editing surface rather than a general input field, using CodeEditor with a CodeLineEditingController much as they would use TextField with a controller.
  • The Reqable project, where Re-Editor is maintained as one of its modules, so its behaviour is exercised in a real product context.
  • Teams replacing a multi-line TextField in an existing Flutter app, since the widget can be introduced as a minimal multi-line input area and extended later with highlighting, folding, and line numbers.
  • Developers building a read-only viewer for large source files, because read-only mode, line numbers, and syntax highlighting are all configurable.
  • Developers assessing the widget by running the example project before committing to the dependency.

Getting started

Add re_editor: ^0.10.0 to the dependencies block of pubspec.yaml, then construct a CodeEditor widget with a controller such as CodeLineEditingController.fromText. The example project in the repository can be run to explore the widget's behaviour before integrating it.

How it compares

No list of paid products replaced by this project is provided, so the useful comparison is with the tools the facts do name: Flutter's built-in TextField, which Re-Editor deliberately does not wrap and is optimised against for large multi-line text, and Re-Highlight, which supplies the highlighting engine rather than competing with the widget. Re-Editor is a widget for embedding in a Flutter application, not a standalone editor application, so it sits alongside those tools rather than replacing them as a product.

When to use it — and when not to

Adopting Re-Editor means adding a Flutter and Dart dependency to an application; there is no database, object storage, or SMTP service to operate, because the deliverable is a widget rather than a server. Developers working outside Flutter or Dart should not choose it, and teams that need a finished find-and-replace panel should note that the widget implements the control logic but leaves the UI to the project. The licence is clearly MIT and the repository shows recent activity, but the README documents the API largely through code samples, and the project carries 39 open issues, so teams with demanding requirements should review those before committing.

project readme (upstream, from github) — read inline

Re-Editor

latest version

中文版本

Re-Editor is a powerful lightweight text and code editor widget and a module in the Reqable project. It can be used as a simple text area or to develop a code editor with complex functions. Unlike Flutter's default TextField, Re-Editor is specifically tailored for the display and input of multi-line text and offers the following features:

  • Two-way horizontal and vertical scrolling.
  • Text syntax highlighting.
  • Content collapsing and expanding.
  • Input hints and auto-completion.
  • Search and replace.
  • Custom context menu builder.
  • Shortcut keys.
  • Large text display and editing.
  • Line numbers and focus line builder.
  • Smart input.

Re-Editor is not a secondary encapsulation based on TextField, but independently implements the layout, drawing, event processing, etc. It is specifically optimized for large texts, providing extremely high performance and fixed some issues of TextField.

Re-Editor offers a high degree of freedom. For example, developers can control whether to enable horizontal scrolling (word wrap), enable read-only mode, display line numbers, display content folding, define custom shortcut keys, and specify text syntax highlighting.

You can run the example project to experience it.

Getting Started

Add the followings in pubspec.yaml.

dependencies:
  re_editor: ^0.10.0

Like TextField, Re-Editor uses CodeLineEditingController as the controller. The following sample code creates the simplest multi-line input area, which is not much different from TextField.

Widget build(BuildContext context) {
  return CodeEditor(
    controller: CodeLineEditingController.fromText('Hello Reqable'),
  );
}

Text Syntax Highlighting

The text highlighting of Re-Editor is based on Re-Highlight and supports nearly a hundred languages ​​and theme styles. Developers can freely choose and configure the code Highlight. The following code specifies the JSON syntax highlighting rules and applies the Atom One Light code coloring.

CodeEditor(
  style: CodeEditorStyle(
    codeTheme: CodeHighlightTheme(
      languages: {
        'json': CodeHighlightThemeMode(
          mode: langJson
        )
      },
      theme: atomOneLightTheme
    ),
  ),
);

Line Numbers and Fold/Unfold Markers

Re-Editor supports configuring whether to display code line numbers and code folding marks, and developers can also implement display styles and layouts by themselves. The example code below shows the default style, built with indicatorBuilder.

CodeEditor(
  indicatorBuilder: (context, editingController, chunkController, notifier) {
    return Row(
      children: [
        DefaultCodeLineNumber(
          controller: editingController,
          notifier: notifier,
        ),
        DefaultCodeChunkIndicator(
          width: 20,
          controller: chunkController,
          notifier: notifier
        )
      ],
    );
  },
);

Code Folding and Unfolding Detection

By default, Re-Editor will automatically detect the folding areas of {} and []. Developers can control whether to detect or write their own detection rules. DefaultCodeChunkAnalyzer is the default detector. If you wish to disable detection, you can use NonCodeChunkAnalyzer.

CodeEditor(
  chunkAnalyzer: DefaultCodeChunkAnalyzer(),
);

If you want to customize it, just implement the CodeChunkAnalyzer interface.

abstract class CodeChunkAnalyzer {

  List<CodeChunk> run(CodeLines codeLines);

}

Scroll Control

Re-Editor supports two-way scrolling, so two ScrollController are used, and developers can use CodeScrollController to construct.

CodeEditor(
  scrollController: CodeScrollController(
    verticalScroller: ScrollController(),
    horizontalScroller: ScrollController(),
  )
);

Find and Replace

Re-Editor implements search and replace control logic, but does not provide a default UI. Developers need to write the UI of the search panel according to the actual situation of their own projects, and use the findBuilder attribute to set up their own search and replace UI.

CodeEditor(
  findBuilder: (context, controller, readOnly) => CodeFindPanelView(controller: controller, readOnly: readOnly),
);

The CodeFindPanelView in the above example is implemented by the developer himself. For the detailed implementation process, please refer to the code in example.

Context Menu

Re-Editor implements the control logic of the desktop context menu and the mobile long-press selection menu, but does not provide a default UI. Developers need to implement the SelectionToolbarController interface and setup it through toolbarController.

CodeEditor(
  toolbarController: _MyToolbarController(),
);

Shortcuts

Re-Editor has the built-in default shortcut hotkeys, and developers can also use shortcutsActivatorsBuilder to set custom shortcut hotkeys. Of course, the shortcut keys only work on the desktop.

The shortcut keys supported by Re-Editor are as follows:

  • Select all (Control/Command + A)
  • Cut selected/current line (Control/Command + V)
  • Copy selected/current line (Control/Command + C)
  • Paste (Control/Command + V)
  • Undo (Control/Command + Z)
  • Redo (Shift + Control/Command + Z)
  • Select the current line (Control/Command + L)
  • Delete current line (Control/Command + D)
  • Move current line (Alt + ↑/↓)
  • Continuous selection (Shift + ↑/↓/←/→)
  • Move cursor (↑/↓/←/→)
  • Move cursor between word boundaries (Alt + ←/→)
  • Move to top/bottom of page (Control/Command + ↑/↓)
  • Indent (Tab)
  • Unindent (Shift + Tab)
  • Comment/uncomment a single line (Control/Command + /)
  • Comment/uncomment multiple lines (Shift + Control/Command + /)
  • Character transpose (Control/Command + T)
  • Search (Control/Command + F)
  • Replace (Alt + Control/Command + F)
  • Save (Control/Command + S)

Code Hints and Auto-Completion

Re-Editor supports using the CodeAutocomplete widget to implement code input prompts and automatic completion. Re-Editor implements basic control logic, but the code prompt content, auto-completion rules and display UI need to be defined by the developer.

CodeAutocomplete(
  viewBuilder: (context, notifier, onSelected) {
    // build the code prompts view
  },
  promptsBuilder: DefaultCodeAutocompletePromptsBuilder(
    language: langDart,
  ),
  child: CodeEditor()
);

Note that Re-Editor is only a lightweight editor and does not have the IDE dynamic syntax analysis, so the code prompts and completion have many limitations. You can refer to the code in example to implement a simple code prompt and completion.

Used By

Re-Editor has been extensively practiced in the Reqable project. You are welcome to download Reqable to experience it.

License

MIT License

Sponsor

If you would like to sponsor this project, you can support us by purchasing a Reqable license.

Frequently asked questions

Is re-editor free to use?

re-editor is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does re-editor do?

Re-Editor is a powerful lightweight text and code editor widget.

What is re-editor written in?

re-editor is primarily written in Dart. Its source is publicly available at https://github.com/reqable/re-editor, and it has 762 GitHub stars.