EditorModel class
Use the EditorModel into CodeEditor in order to control the editor.
EditorModel extends ChangeNotifier because we use the provider package to simplify the work.
- Inheritance
-
- Object
- ChangeNotifier
- EditorModel
Constructors
-
EditorModel({required List<
FileEditor> files, EditorModelStyleOptions? styleOptions}) -
Define the required parameters for the editor to work properly.
For that, you need to define
files
wich is aList<FileEditor>
.
Properties
-
allFiles
↔ List<
FileEditor> -
getter/setter pair
- currentLanguage → String?
-
Gets which language is currently shown.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isEditing → bool
-
Is the text field shown ?
no setter
- numberOfFiles → int
-
Gets the number of files.
no setter
- position → int?
-
Gets the index of wich file is currently displayed in the editor.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- styleOptions ↔ EditorModelStyleOptions?
-
getter/setter pair
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
changeIndexTo(
int i) → void -
Switch the file using
i
as index of the List -
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
getCodeWithIndex(
int index) → String? -
Returns the code of the file where
index
corresponds. -
getCodeWithLanguage(
String language) → List< String?> -
Checks in all the given files if
language
is found, then returns a List -
getFileWithIndex(
int index) → FileEditor -
Returns the file where
index
corresponds. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notify(
) → void -
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
toggleEditing(
) → void - Toggle the text field.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateCodeOfIndex(
int index, String? newCode) → void -
Overwite the previous code of the file where
index
corresponds bynewCode
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited