LogViewerPage class
Log page: a list of entries, newest first, with loading more on scroll, search, a filter by levels and tags, an entry page on tap, and export (onExport). State is managed by LogViewerController; strings come from LogViewerStrings.of, colors from LogViewerTheme.of.
The page is one widget over a controller; the constructor decides where the controller comes from: LogViewerPage.new creates and owns its own over a store, LogViewerPage.withController shows an external one. Switching from one to the other on rebuild disposes the own controller and shows the external one, as if the page were closed and reopened.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- LogViewerPage
Constructors
- LogViewerPage({required LogReader reader, required DiagnosticReporter diagnostics, TagPredicate? isTagVisible, int pageSize = LogViewerController.defaultPageSize, int maxEntries = LogViewerController.defaultMaxEntries, LogFilter initialFilter = const LogFilter(), LogEntrySelectedCallback? onEntrySelected, LogExportCallback? onExport, Key? key})
-
Page with its own controller over
reader: the controller is created when the page opens and disposed when it closes, along with the loaded entries and the selected filter. - LogViewerPage.withController({required LogViewerController controller, TagPredicate? isTagVisible, LogEntrySelectedCallback? onEntrySelected, LogExportCallback? onExport, Key? key})
-
Page over an external
controller: loaded entries and the filter live as long as the controller, not the page (for example, between openings of the page), and in tests the controller can be prepared in advance. Page size, limit, filter and diagnostics channel are settings of the controller itself. The page does not dispose the controller: the caller owns it.
Properties
- controller → LogViewerController?
-
External controller (LogViewerPage.withController);
nullif the page creates its own.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- isTagVisible → TagPredicate?
-
Which tags to show in the list, the filter and the entry page;
nullmeans all.final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onEntrySelected → LogEntrySelectedCallback?
-
What to do on tapping an entry. By default opens LogEntryDetailsPage via Navigator.push
with a MaterialPageRoute named detailsRouteName. Set your own handler if the app
navigates differently (go_router, custom transitions) or shows the entry its own way.
final
- onExport → LogExportCallback?
-
Log export with the page's current filter, for example to send to support; without it
there is no export button. How to deliver the result (clipboard, share, file) is up to the
app:
final
- reader → LogReader?
-
Where to read the log from (LogViewerPage.new); any LogStore works. The page does not
close the store.
nullfor a page over an external controller.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
BuildContext context) → Widget -
Different controller sources are different widgets: when the source changes, Flutter itself
disposes the previous state (and the own controller with it) and creates a new one, with no
case analysis in
didUpdateWidget.override -
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- detailsRouteName → const String
-
Route name of the entry page the page opens by default (onEntrySelected not set); the
route's
argumentsis the StoredLogEntry itself, typed: a navigator observer or analytics can access itsid. - filterRouteName → const String
- Route name of the filter bottom sheet.