Aus öffentlichen Paketdaten erstellte Orientierung.
Ein Dart-Wrapper für den CodeMirror-Texteditor, der reichhaltige Codebearbeitungsfunktionen in Flutter-Web-Anwendungen ermöglicht. Er bietet Syntax-Highlighting, Zeilennummern und anpassbare Themen und nutzt direkt die leistungsstarke CodeMirror-Bibliothek im Browser. Dieses Paket ist ideal für die Entwicklung interaktiver Codeeditoren, IDE-ähnliche Funktionen oder jede Anwendung, die erweiterte Textbearbeitung mit sprachspezifischer Syntaxunterstützung erfordert. Die Integration ist nahtlos für Web-only Flutter-Projekte und sorgt für eine vertraute und leistungsstarke Bearbeitungserfahrung.
Anwendungsfälle
Web-basierte Code-Editoren
Interaktive Coding-Tutorials
IDE-ähnliche Webanwendungen
Echtzeit-Code-Kooperation
Syntax-Highlighting-Eingabefelder
Hauptmerkmale
Syntax-Highlighting
Zeilennummerierung
Anpassbare Themen
Browser-basierte Rendering
Erweiterbar über CodeMirror-Plugins
Geeignet für
Flutter-Web-Entwickler
Bildungsplattformen
Code-Sharing-Tools
Entwicklerwerkzeuge
Web-basierte IDEs
Hinweise
Web-only-Plattformunterstützung
Benötigt JavaScript-Interop
Beschränkt auf Browser-Umgebungen
Abhängig von der externen CodeMirror-Bibliothek
Kann die Bundle-Größe erhöhen
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
codemirror.dart
What is it?
A Dart wrapper around the CodeMirror text editor. From
codemirror.net:
CodeMirror is a versatile text editor implemented in JavaScript for the
browser. It is specialized for editing code, and comes with a number of language
modes and addons that implement more advanced editing functionality.
Note: This is NOT a Flutter package, it is a Dart package for writing web applications
like DartPad.
An example
final options = <String, String>{
'mode': 'javascript',
'theme': 'monokai'
};
final editor = CodeMirror.fromElement(
document.querySelector('#textContainer')!, options: options);
editor.doc.setValue('foo.bar(1, 2, 3);');
This Dart package ships with several language modes built in. CodeMirror itself
supports over 100 modes; the modes built into the Dart package include the
usual suspects for web development - css, html, dart and javascript as
well as a few
others.
In order to add additional modes, you'll need to reference the mode file from
your html entry point. So,
Similarly with addons, we've included a few common ones, and have made the
others available to import on a case-by-case basis. In order to use the
active-line addon, import:
Be aware that many addons need additional configuration in order to enable then.
This is generally done by passing values into the options of the CodeMirror
constructor.
Some addons are exposed through the main Dart interface. Some are exposed via
side-car Dart libraries available in the main
package, and some
have yet to be exposed. Pull requests welcome :)
You get access to all the CodeMirror themes. If you only want a few, or don't
want to pay the network roundtrip cost to load all the themes, you can import
only the ones you're interested in: