CodeController constructor

CodeController({
  1. String? text,
  2. Mode? language,
  3. Map<String, TextStyle>? theme,
  4. Map<String, TextStyle>? patternMap,
  5. Map<String, TextStyle>? stringMap,
  6. EditorParams params = const EditorParams(),
  7. List<CodeModifier> modifiers = const <CodeModifier>[const IntendModifier(), const CloseBlockModifier(), const TabModifier()],
  8. bool webSpaceFix = true,
  9. void onChange(
    1. String
    )?,
})

Implementation

CodeController({
  String? text,
  this.language,
  this.theme,
  this.patternMap,
  this.stringMap,
  this.params = const EditorParams(),
  this.modifiers = const <CodeModifier>[
    const IntendModifier(),
    const CloseBlockModifier(),
    const TabModifier(),
  ],
  this.webSpaceFix = true,
  this.onChange,
}) : super(text: text) {
  // PatternMap
  if (language != null && theme == null)
    throw Exception("A theme must be provided for language parsing");
  // Register language
  if (language != null) {
    highlight.registerLanguage(languageId, language!);
  }
  // Create modifier map
  modifiers.forEach((el) {
    modifierMap[el.char] = el;
  });
}