PrintLibrary class

Manages a print library: templates, their categories and the paper formats, kept by a PrintStore.

Nothing is changed locally first: every change goes to the store and the lists change only when the store accepted it.

Inheritance

Constructors

PrintLibrary({required PrintStore store, PrintLibraryOptions options = const PrintLibraryOptions()})

Properties

canManage → bool
no setter
categories → List<PrintCategory>
Categories sorted by position, then by name.
no setter
defaultsLoaded → bool
no setter
error → Object?
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
loaded → bool
no setter
loading → bool
no setter
nextCategoryPosition → int
no setter
options → PrintLibraryOptions
final
paperFormats → List<PaperFormat>
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
store → PrintStore
Where the library is read from and written to.
final
templates → List<PrintTemplate>
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
deleteCategory(String categoryId) → Future<void>
Deletes the category. Its templates stay and are listed without a category until they are moved.
deletePaperFormat(String formatId) → Future<void>
deleteTemplate(String templateId) → Future<void>
dispose() → void
Discards any resources used by the object.
inherited
grouped({bool where(PrintTemplate template)?}) → List<({PrintCategory? category, List<PrintTemplate> templates})>
Templates grouped by category, in category order. Templates whose category does not exist any more are listed under a null key at the end.
load(BuildContext context, {bool force = false}) → Future<void>
Reads the library from the store. The first time a user allowed to manage it opens it, the defaults of options are stored once.
moveCategory(PrintCategory category, int direction) → Future<void>
Moves category one place up (-1) or down (+1) and stores the new positions of every category.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
paperFormatOf(PrintTemplate template, {String? overrideId}) → PaperFormat
The paper format of template. When it was deleted, a single page as big as the design is used, so the template still prints.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
saveCategory(PrintCategory category) → Future<void>
savePaperFormat(PaperFormat format) → Future<void>
saveTemplate(PrintTemplate template) → Future<void>
templatesUsing(String formatId) → int
Templates that print on formatId, shown before deleting a format.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

newPaperFormatId() → String