LogViewerController class

Widget-free state of the log viewer: first page from reader, loading more older entries, the filter, and updates from LogReader.changes.

Construction starts nothing: start subscribes to changes and loads the first page (LogViewerPage calls it itself, also for an external controller). Listeners are notified of every state change. LogViewerPage is built on top of it; it also suits a custom list (for example, Cupertino).

Loaded entries are a LogWindow under filter: a contiguous stretch of the log from the newest entries to the last one loaded. Store changes modify it in place, and an entry that arrives during a query is neither lost nor duplicated. The first page is re-read only on LogStoreInvalidated and after an error in the changes stream.

Does not own the store and cannot close it: reading (LogReader) is enough; dispose only unsubscribes from changes.

Inheritance

Constructors

LogViewerController(LogReader reader, {required DiagnosticReporter diagnostics, int pageSize = defaultPageSize, int maxEntries = defaultMaxEntries, LogFilter filter = const LogFilter()})

Properties

availableTags → Set<String>
Tags of the store's entries, including those that arrived via LogReader.changes: for the list in the filter, which does not depend on the loaded pages.
no setter
diagnostics → DiagnosticReporter
Where store read failures go, with stack traces, like in the rest of the library: usually the root's channel (RootLogger.diagnostics), so the handler set on the root also sees viewer failures. There is no default: the viewer is not attached to the root and cannot obtain the channel itself, and a forgotten parameter would silently send failures to the console. For a prototype pass DiagnosticReporter.console explicitly. The user sees the failure through loadError and loadMoreError.
final
entries → List<StoredLogEntry>?
Entries matching filter, newest first. null until the first page is loaded, including after an error (loadError).
no setter
filter → LogFilter
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
hasMore → bool
Whether there are entries older than the loaded ones.
no setter
isLoadingMore → bool
no setter
isStarted → bool
Whether start has been called.
no setter
loadError → Object?
Error of the last first-page load; null if there was none.
no setter
loadMoreError → Object?
Error of the last loading more; until it is cleared (retryLoadMore), loadMore does nothing: scrolling must not repeat the failure in a loop.
no setter
maxEntries → int
How many entries to keep while the screen is open and new ones arrive: otherwise the list would grow without bound over hours of use. The oldest entries over the limit are dropped and can be loaded again (loadMore).
final
pageSize → int
How many entries to load at a time (loadMore).
final
reader → LogReader
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() → void
Discards any resources used by the object.
override
loadMore() → Future<void>
Loads the next page of older entries if there is one and no other load is running. Safe to call on every scroll event.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
reload() → void
Reloads the first page: entries and loadError are cleared for the duration of the load. Does nothing before start, which loads itself.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
retryLoadMore() → Future<void>
Clears loadMoreError and retries loading more.
setFilter(LogFilter filter) → void
Applies filter and reloads the first page.
start() → void
Subscribes to store changes and loads the first page. A repeated call does nothing; to load again, use reload.
toString() → String
A string representation of this object.
inherited
updateFilter(LogFilterUpdate update) → void
Applies update to the current filter and reloads the first page: for edits of some conditions that must keep the others as they are now (the filter sheet).

Operators

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

Constants

defaultMaxEntries → const int
defaultPageSize → const int
Defaults for pageSize and maxEntries; LogViewerPage uses the same.