Model class

The application model singleton that contains current application state.

Inheritance

Properties

currentElement ↔ SourceElement?
The element corresponding to the currently selected code sample.
getter/setter pair
currentSample ↔ CodeSample?
The currently selected code sample, or null, if none is selected.
getter/setter pair
dartUiRoot ↔ Directory
The location of the dart:ui root, so that the examples in that root may be edited.
getter/setter pair
elements Iterable<SourceElement>?
The Dart elements (classes, members, etc.) defined in the workingFile.
no setter
files List<File>?
The list of source files available in the Flutter framework and dart:ui.
getter/setter pair
filesystem → FileSystem
The FileSystem used to handle filesystem requests.
final
flutterPackageRoot → Directory
The location of the flutter framework package directory.
no setter
flutterRoot ↔ Directory
The location of the flutter root directory to look for files in.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
samples Iterable<CodeSample>
The list of samples available in all of the elements in the file.
no setter
workingFile → File?
Gets the current Flutter dart source file that is being worked on.
no setter
workingFileContents String?
Gets the contents of the workingFile as a String.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
clearWorkingFile({bool notify = true}) → void
Unset the current working file, and clear out any cached data.
collectFiles(Iterable<Directory> directories, {String suffix = '.dart'}) Future<void>
Collects the list of Flutter source files to choose from and populates the files member.
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
getElementForSample(CodeSample sample) → SourceElement?
Find the element that owns a particular sample.
getTemplateNames() Iterable<String>
Get the names of all the available templates in the templates dir.
insertNewSample({Type sampleType = SnippetSample, String? template}) Future<void>
Inserts a new sample placeholder into the currentElement, and write it out to the workingFile.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
reloadWorkingFile({bool notify = true}) Future<void>
Re-parses the working file, and attempts to set the current sample and element to the updated sample and element, if they exist.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
setWorkingFile(File value) Future<void>
Set the current working file, resetting any cached data.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance Model
Get the singleton instance for the model class.
no setter

Static Methods

resetInstance({File? workingFile, Directory? flutterRoot, Directory? dartUiRoot, FileSystem filesystem = const LocalFileSystem()}) → void
Resets the instance with new parameters.