Documentation
¶
Overview ¶
Package foundation holds the basic building blocks of the framework: Key, Opt[T], ChangeNotifier, TargetPlatform, diagnostics and debug flags.
Everything here is used from the UI thread only (SPEC §13).
Flutter: package:flutter/foundation.dart.
Index ¶
- Constants
- Variables
- func DebugFormatDouble(value Opt[float64]) string
- func DescribeIdentity(object any) string
- func DiagnosticableString(d Diagnosticable, minLevel ...DiagnosticLevel) string
- func GraphemeBoundaries(text string) []int
- func GraphemeCount(text string) int
- func GraphemeOffset(text string, n int) int
- func Guard(report ErrorReporter, tag, context string, kv func() []any, fn func()) (panicked bool)
- func GuardLazy(report ErrorReporter, tag string, context func() string, kv func() []any, ...) (panicked bool)
- func InitDiagnosticsNodeBase(base *DiagnosticsNodeBase, self DiagnosticsNode, opts DiagnosticsNodeBaseOpts)
- func IsRecoveredPanic(err error) bool
- func PanicError(tag, context string, recovered any, kv ...any) error
- func RuntimeTypeName(object any) string
- func SameRuntimeType(a, b any) bool
- func SetDebugDefaultTargetPlatformOverride(p Opt[TargetPlatform])
- func ShortHash(object any) string
- func ToStringDeep(tree DiagnosticableTree, opts ...ToStringDeepOpts) string
- func ToStringShallow(d Diagnosticable, opts ...ToStringShallowOpts) string
- func ToStringShort(object any) string
- func TraceEnabled() bool
- func TraceLog(category, message string)
- func ValuesEqual(a, b any) bool
- type ChangeNotifier
- func (n *ChangeNotifier) AddListener(listener VoidCallback) ListenerHandle
- func (n *ChangeNotifier) DebugAssertNotDisposed() bool
- func (n *ChangeNotifier) Dispose()
- func (n *ChangeNotifier) HasListeners() bool
- func (n *ChangeNotifier) NotifyListeners()
- func (n *ChangeNotifier) RemoveListener(handle ListenerHandle)
- func (n *ChangeNotifier) SetErrorReporter(r ErrorReporter)
- func (n *ChangeNotifier) SetUIThread(t *UIThread)
- type DiagnosticLevel
- type DiagnosticPropertiesBuilder
- type Diagnosticable
- type DiagnosticableNode
- func (n *DiagnosticableNode) EmptyBodyDescription() Opt[string]
- func (n *DiagnosticableNode) GetChildren() []DiagnosticsNode
- func (n *DiagnosticableNode) GetProperties() []DiagnosticsNode
- func (n *DiagnosticableNode) Style() DiagnosticsTreeStyle
- func (n *DiagnosticableNode) ToDescription(*TextTreeConfiguration) string
- func (n *DiagnosticableNode) Value() any
- type DiagnosticableTree
- type DiagnosticsBlock
- func (b *DiagnosticsBlock) AllowTruncate() bool
- func (b *DiagnosticsBlock) GetChildren() []DiagnosticsNode
- func (b *DiagnosticsBlock) GetProperties() []DiagnosticsNode
- func (b *DiagnosticsBlock) Level() DiagnosticLevel
- func (b *DiagnosticsBlock) ToDescription(*TextTreeConfiguration) string
- func (b *DiagnosticsBlock) Value() any
- type DiagnosticsBlockOpts
- type DiagnosticsNode
- type DiagnosticsNodeBase
- func (b *DiagnosticsNodeBase) AllowNameWrap() bool
- func (b *DiagnosticsNodeBase) AllowTruncate() bool
- func (b *DiagnosticsNodeBase) AllowWrap() bool
- func (b *DiagnosticsNodeBase) EmptyBodyDescription() Opt[string]
- func (b *DiagnosticsNodeBase) IsFiltered(minLevel DiagnosticLevel) bool
- func (b *DiagnosticsNodeBase) Level() DiagnosticLevel
- func (b *DiagnosticsNodeBase) LinePrefix() Opt[string]
- func (b *DiagnosticsNodeBase) Name() Opt[string]
- func (b *DiagnosticsNodeBase) ShowName() bool
- func (b *DiagnosticsNodeBase) ShowSeparator() bool
- func (b *DiagnosticsNodeBase) String() string
- func (b *DiagnosticsNodeBase) Style() DiagnosticsTreeStyle
- func (b *DiagnosticsNodeBase) TextTreeConfiguration() *TextTreeConfiguration
- func (b *DiagnosticsNodeBase) ToStringDeep(opts ...ToStringDeepOpts) string
- func (b *DiagnosticsNodeBase) ToStringWith(parentConfiguration *TextTreeConfiguration, minLevel DiagnosticLevel) string
- type DiagnosticsNodeBaseOpts
- type DiagnosticsNodeMessageOpts
- type DiagnosticsNodeOpts
- type DiagnosticsNodeProvider
- type DiagnosticsProperty
- func NewDiagnosticsNodeMessage(message string, opts ...DiagnosticsNodeMessageOpts) *DiagnosticsProperty
- func NewDiagnosticsProperty[T any](name string, value T, opts ...DiagnosticsPropertyOpts) *DiagnosticsProperty
- func NewDiagnosticsPropertyLazy[T any](name string, computeValue func() T, opts ...DiagnosticsPropertyOpts) *DiagnosticsProperty
- func NewDiagnosticsPropertyOpt[T any](name string, value Opt[T], opts ...DiagnosticsPropertyOpts) *DiagnosticsProperty
- func NewDoubleProperty(name string, value Opt[float64], opts ...NumberPropertyOpts) *DiagnosticsProperty
- func NewDoublePropertyLazy(name string, computeValue func() Opt[float64], opts ...NumberPropertyOpts) *DiagnosticsProperty
- func NewEnumProperty[T EnumValue](name string, value Opt[T], opts ...EnumPropertyOpts) *DiagnosticsProperty
- func NewFlagProperty(name string, value Opt[bool], opts ...FlagPropertyOpts) *DiagnosticsProperty
- func NewFlagsSummary(name string, entries []FlagEntry, opts ...FlagsSummaryOpts) *DiagnosticsProperty
- func NewIntProperty(name string, value Opt[int], opts ...NumberPropertyOpts) *DiagnosticsProperty
- func NewIterableProperty[T any](name string, value []T, opts ...IterablePropertyOpts) *DiagnosticsProperty
- func NewMessageProperty(name, message string, opts ...MessagePropertyOpts) *DiagnosticsProperty
- func NewObjectFlagProperty[T any](name string, value T, opts ...ObjectFlagPropertyOpts) *DiagnosticsProperty
- func NewObjectFlagPropertyHas[T any](name string, value T, level ...DiagnosticLevel) *DiagnosticsProperty
- func NewPercentProperty(name string, fraction Opt[float64], opts ...NumberPropertyOpts) *DiagnosticsProperty
- func NewStringProperty(name string, value Opt[string], opts ...StringPropertyOpts) *DiagnosticsProperty
- func (p *DiagnosticsProperty) AllowNameWrap() bool
- func (p *DiagnosticsProperty) AllowWrap() bool
- func (p *DiagnosticsProperty) DefaultValue() (any, bool)
- func (p *DiagnosticsProperty) Exception() any
- func (p *DiagnosticsProperty) GetChildren() []DiagnosticsNode
- func (p *DiagnosticsProperty) GetProperties() []DiagnosticsNode
- func (p *DiagnosticsProperty) IfEmpty() Opt[string]
- func (p *DiagnosticsProperty) IfNull() Opt[string]
- func (p *DiagnosticsProperty) IsInteresting() bool
- func (p *DiagnosticsProperty) Level() DiagnosticLevel
- func (p *DiagnosticsProperty) MissingIfNull() bool
- func (p *DiagnosticsProperty) PropertyType() string
- func (p *DiagnosticsProperty) ShowName() bool
- func (p *DiagnosticsProperty) ToDescription(parent *TextTreeConfiguration) string
- func (p *DiagnosticsProperty) Tooltip() Opt[string]
- func (p *DiagnosticsProperty) TypeName() string
- func (p *DiagnosticsProperty) Value() any
- func (p *DiagnosticsProperty) ValueToString(parent *TextTreeConfiguration) string
- type DiagnosticsPropertyOpts
- type DiagnosticsTreeStyle
- type EnumPropertyOpts
- type EnumValue
- type ErrorReporter
- type FlagEntry
- type FlagPropertyOpts
- type FlagsSummaryOpts
- type IterablePropertyOpts
- type Key
- type KeyBase
- type Listenable
- type ListenerHandle
- type LocalKey
- type LocalKeyBase
- type MessagePropertyOpts
- type NumberPropertyOpts
- type ObjectFlagPropertyOpts
- type ObjectKey
- type Opt
- type RenderOpts
- type ShortDescriber
- type StringPropertyOpts
- type TargetPlatform
- type TextTreeConfiguration
- type TextTreeRenderer
- type TextTreeRendererOpts
- type ToStringDeepOpts
- type ToStringShallowOpts
- type TraceRegion
- type UIThread
- type UniqueKey
- type ValueKey
- type ValueListenable
- type ValueNotifier
- type VoidCallback
Constants ¶
const ( // BuildPanicked is a panic in a Build method (or a lifecycle hook) of a // widget. // // Flutter: widgets/framework.dart ComponentElement.performRebuild BuildPanicked = "BuildPanicked" // LayoutPanicked is a panic while a render object lays itself out. // // Flutter: rendering/object.dart RenderObject._reportException LayoutPanicked = "LayoutPanicked" // PaintPanicked is a panic while a render object paints. // // Flutter: rendering/object.dart RenderObject._reportException PaintPanicked = "PaintPanicked" // CallbackPanicked is a panic in any other callback that the framework // calls: a gesture callback, a listener, a frame callback, a task. // // Flutter: foundation/assertions.dart FlutterError.reportError CallbackPanicked = "CallbackPanicked" )
The tags of the errors made from recovered panics.
const DebugMode = false
DebugMode is true in a build made with the tag debug_mode. Debug-only checks (Flutter's asserts, SPEC §12.9) and diagnostics run only then. It wins when both debug_mode and glutter_profile are given.
Flutter: foundation/constants.dart kDebugMode
const IsWeb = false
IsWeb is whether the program runs on the web: true under GOOS=js GOARCH=wasm.
Flutter: foundation/constants.dart kIsWeb
const PrecisionErrorTolerance = 1e-10
PrecisionErrorTolerance is the tolerance for floating point comparisons: two values closer than this are treated as equal.
Flutter: foundation/constants.dart precisionErrorTolerance
const ProfileMode = false
ProfileMode is true in a build made with the tag glutter_profile and not debug_mode.
Flutter: foundation/constants.dart kProfileMode
const ReleaseMode = true
ReleaseMode is true in a build made without the tags debug_mode and glutter_profile, the default: a plain go build, go run or go install.
Flutter: foundation/constants.dart kReleaseMode
Variables ¶
var DashedTextConfiguration = newTextTreeConfiguration(func(c *TextTreeConfiguration) {
c.PrefixLineOne = "╎╌"
c.PrefixLastChildLineOne = "└╌"
c.PrefixOtherLines = " "
c.LinkCharacter = "╎"
c.PropertyPrefixIfChildren = "│ "
c.PropertyPrefixNoChildren = " "
c.PrefixOtherLinesRootNode = " "
})
DashedTextConfiguration draws a tree with dashed lines, for a node that is not on the screen. It never changes.
Flutter: foundation/diagnostics.dart dashedTextConfiguration
var DefaultNull = noDefault{}
DefaultNull is the DefaultValue that means Dart's `defaultValue: null`: a property whose value is nil has its default value. Leave DefaultValue unset (nil) for a property that has no default value.
Flutter: foundation/diagnostics.dart kNoDefaultValue (the opposite: Go's nil is the absence)
var DenseTextConfiguration = newTextTreeConfiguration(func(c *TextTreeConfiguration) { c.PropertySeparator = ", " c.BeforeProperties = "(" c.AfterProperties = ")" c.LineBreakProperties = false c.PrefixLineOne = "├" c.PrefixOtherLines = "" c.PrefixLastChildLineOne = "└" c.LinkCharacter = "│" c.PropertyPrefixIfChildren = "│" c.PropertyPrefixNoChildren = " " c.PrefixOtherLinesRootNode = "" c.AddBlankLineIfNoChildren = false c.IsBlankLineBetweenPropertiesAndChildren = false })
DenseTextConfiguration draws a tree without blank lines and with the properties on one line. It never changes.
Flutter: foundation/diagnostics.dart denseTextConfiguration
var ErrorPropertyTextConfiguration = newTextTreeConfiguration(func(c *TextTreeConfiguration) { c.PropertySeparator = ", " c.BeforeProperties = "(" c.AfterProperties = ")" c.PrefixLineOne = "" c.PrefixOtherLines = "" c.PrefixLastChildLineOne = "" c.LineBreakProperties = false c.AddBlankLineIfNoChildren = false c.ShowChildren = false c.PropertyPrefixIfChildren = " " c.PropertyPrefixNoChildren = " " c.LinkCharacter = "" c.PrefixOtherLinesRootNode = "" c.IsNameOnOwnLine = true })
ErrorPropertyTextConfiguration draws a property of an error message. It never changes.
Flutter: foundation/diagnostics.dart errorPropertyTextConfiguration
var ErrorTextConfiguration = newTextTreeConfiguration(func(c *TextTreeConfiguration) { c.PrefixLineOne = "╞═╦" c.PrefixLastChildLineOne = "╘═╦" c.PrefixOtherLines = " ║ " c.Footer = " ╚═══════════" c.LinkCharacter = "│" c.PropertyPrefixIfChildren = "" c.PropertyPrefixNoChildren = "" c.PrefixOtherLinesRootNode = "" c.BeforeName = "══╡ " c.SuffixLineOne = " ╞══" c.MandatoryFooter = "═════" c.AddBlankLineIfNoChildren = false c.IsBlankLineBetweenPropertiesAndChildren = false })
ErrorTextConfiguration draws an error message in a box. It never changes.
Flutter: foundation/diagnostics.dart errorTextConfiguration
var FlatTextConfiguration = newTextTreeConfiguration(func(c *TextTreeConfiguration) { c.PrefixLineOne = "" c.PrefixLastChildLineOne = "" c.PrefixOtherLines = "" c.PrefixOtherLinesRootNode = "" c.PropertyPrefixIfChildren = "" c.PropertyPrefixNoChildren = "" c.LinkCharacter = "" c.AddBlankLineIfNoChildren = false c.AfterDescriptionIfBody = ":" c.IsBlankLineBetweenPropertiesAndChildren = false })
FlatTextConfiguration draws a tree without indentation. It never changes.
Flutter: foundation/diagnostics.dart flatTextConfiguration
var ShallowTextConfiguration = newTextTreeConfiguration(func(c *TextTreeConfiguration) { c.PrefixLineOne = "" c.PrefixLastChildLineOne = "" c.PrefixOtherLines = " " c.PrefixOtherLinesRootNode = " " c.PropertyPrefixIfChildren = "" c.PropertyPrefixNoChildren = "" c.LinkCharacter = " " c.AddBlankLineIfNoChildren = false c.AfterDescriptionIfBody = ":" c.IsBlankLineBetweenPropertiesAndChildren = false c.ShowChildren = false })
ShallowTextConfiguration draws a node without its children. It never changes.
Flutter: foundation/diagnostics.dart shallowTextConfiguration
var SingleLineTextConfiguration = newTextTreeConfiguration(func(c *TextTreeConfiguration) { c.PropertySeparator = ", " c.BeforeProperties = "(" c.AfterProperties = ")" c.PrefixLineOne = "" c.PrefixOtherLines = "" c.PrefixLastChildLineOne = "" c.LineBreak = "" c.LineBreakProperties = false c.AddBlankLineIfNoChildren = false c.ShowChildren = false c.PropertyPrefixIfChildren = " " c.PropertyPrefixNoChildren = " " c.LinkCharacter = "" c.PrefixOtherLinesRootNode = "" })
SingleLineTextConfiguration draws a node on one line, with its properties in parentheses. It never changes.
Flutter: foundation/diagnostics.dart singleLineTextConfiguration
var SparseTextConfiguration = newTextTreeConfiguration(func(c *TextTreeConfiguration) {
c.PrefixLineOne = "├─"
c.PrefixOtherLines = " "
c.PrefixLastChildLineOne = "└─"
c.LinkCharacter = "│"
c.PropertyPrefixIfChildren = "│ "
c.PropertyPrefixNoChildren = " "
c.PrefixOtherLinesRootNode = " "
})
SparseTextConfiguration draws a tree with lines; it is the default style. It never changes.
Flutter: foundation/diagnostics.dart sparseTextConfiguration
var TransitionTextConfiguration = newTextTreeConfiguration(func(c *TextTreeConfiguration) { c.PrefixLineOne = "╞═╦══ " c.PrefixLastChildLineOne = "╘═╦══ " c.PrefixOtherLines = " ║ " c.Footer = " ╚═══════════" c.LinkCharacter = "│" c.PropertyPrefixIfChildren = "" c.PropertyPrefixNoChildren = "" c.PrefixOtherLinesRootNode = "" c.AfterName = " ═══" c.AfterDescriptionIfBody = ":" c.BodyIndent = " " c.IsNameOnOwnLine = true c.AddBlankLineIfNoChildren = false c.IsBlankLineBetweenPropertiesAndChildren = false })
TransitionTextConfiguration draws a subtree in a box. It never changes.
Flutter: foundation/diagnostics.dart transitionTextConfiguration
var WhitespaceTextConfiguration = newTextTreeConfiguration(func(c *TextTreeConfiguration) { c.PrefixLineOne = "" c.PrefixLastChildLineOne = "" c.PrefixOtherLines = " " c.PrefixOtherLinesRootNode = " " c.PropertyPrefixIfChildren = "" c.PropertyPrefixNoChildren = "" c.LinkCharacter = " " c.AddBlankLineIfNoChildren = false c.AfterDescriptionIfBody = ":" c.IsBlankLineBetweenPropertiesAndChildren = false })
WhitespaceTextConfiguration draws a tree with indentation instead of lines. It never changes.
Flutter: foundation/diagnostics.dart whitespaceTextConfiguration
Functions ¶
func DebugFormatDouble ¶
DebugFormatDouble formats a number for diagnostics: one decimal, as Dart's toStringAsFixed(1).
Flutter: foundation/debug.dart debugFormatDouble
func DescribeIdentity ¶
DescribeIdentity returns the object's type name and ShortHash, such as "ValueNotifier<int>#1a2b3". A nil object is "Null#00000".
Flutter: foundation/diagnostics.dart describeIdentity
func DiagnosticableString ¶
func DiagnosticableString(d Diagnosticable, minLevel ...DiagnosticLevel) string
DiagnosticableString describes the object and its properties on one line, at a minimum level (the default is info). It is what Flutter's Diagnosticable.toString gives. Release builds give ToStringShort.
Flutter: foundation/diagnostics.dart Diagnosticable.toString
func GraphemeBoundaries ¶
GraphemeBoundaries are the byte offsets of the boundaries between the characters (grapheme clusters) of the text, in order, including 0 and the length of the text (only 0 for the empty text).
Flutter: characters/characters.dart CharacterRange.at
func GraphemeCount ¶
GraphemeCount is the number of user-perceived characters (extended grapheme clusters) of the text: Dart's text.characters.length.
Flutter: characters/characters.dart Characters.length
func GraphemeOffset ¶
GraphemeOffset is the byte offset where the n-th character (grapheme cluster) of the text ends; the length of the text when it has fewer than n.
Flutter: characters/characters.dart Characters.take
func Guard ¶
func Guard(report ErrorReporter, tag, context string, kv func() []any, fn func()) (panicked bool)
Guard runs fn. If fn panics and report is not nil, the panic is recovered, made into an error with PanicError and given to report, and Guard returns true. If report is nil nothing is recovered: the panic goes on, so that a program that has no reporter does not lose its errors.
kv is a function so that the pairs, such as the element path, are made only when there is something to report; it may be nil.
Flutter: foundation/assertions.dart FlutterError.reportError
func GuardLazy ¶
func GuardLazy(report ErrorReporter, tag string, context func() string, kv func() []any, fn func()) (panicked bool)
GuardLazy is Guard with the context made only when there is a panic to report: the context of a build is the description of the element, which costs a walk of its properties and is wasted on every build that does not panic.
Flutter: no counterpart
func InitDiagnosticsNodeBase ¶
func InitDiagnosticsNodeBase(base *DiagnosticsNodeBase, self DiagnosticsNode, opts DiagnosticsNodeBaseOpts)
InitDiagnosticsNodeBase sets up the embedded base of the node self.
Flutter: foundation/diagnostics.dart DiagnosticsNode.new
func IsRecoveredPanic ¶
IsRecoveredPanic reports whether err was made by PanicError, that is, whether it is the report of a panic that the framework recovered.
Flutter: foundation/assertions.dart FlutterErrorDetails
func PanicError ¶
PanicError makes the error to report for a recovered panic. The tag is one of BuildPanicked, LayoutPanicked, PaintPanicked and CallbackPanicked; context says what the framework was doing ("while building Foo"); the metadata has the panic value (panic), the stack of the goroutine (stack), the context and the pairs given in kv, such as the element path.
Deviation: a panic that is already a tagged *errors.Error, such as a failed debug check (SetStateAfterDispose), is reported as it is, with the context, the stack and kv added to its metadata, so that its own tag stays the route of the error (SPEC §14.2, §12.10).
Flutter: foundation/assertions.dart FlutterErrorDetails
func RuntimeTypeName ¶
RuntimeTypeName returns the name of the object's type the way Dart prints a runtimeType: no package, no pointer star, and angle brackets around type arguments ("ValueNotifier<int>"). A nil object is "Null".
Flutter: foundation/object.dart objectRuntimeType
func SameRuntimeType ¶
SameRuntimeType reports whether the two objects have the same runtimeType: the same type once pointers are looked through, as RuntimeTypeName does (so a T and a *T are one type), and nil is the type of nil only. It is the comparison `a.runtimeType == b.runtimeType` of Flutter's framework, which RuntimeTypeName(a) == RuntimeTypeName(b) also answers but at the price of building two names (regular expressions over the type's string), a price that a widget update pays for each CustomPaint and each clipper.
Flutter: foundation/object.dart Object.runtimeType
func SetDebugDefaultTargetPlatformOverride ¶
func SetDebugDefaultTargetPlatformOverride(p Opt[TargetPlatform])
SetDebugDefaultTargetPlatformOverride makes DefaultTargetPlatform return p, or removes the override when p is None. Tests use it, and must remove the override when they are done. In a build that is not a debug build it panics with the tag TargetPlatformOverrideNotDebug.
Flutter: foundation/platform.dart debugDefaultTargetPlatformOverride=
func ShortHash ¶
ShortHash returns the first five hex digits of the object's identity hash, which tell objects apart in debug output.
Flutter: foundation/diagnostics.dart shortHash
func ToStringDeep ¶
func ToStringDeep(tree DiagnosticableTree, opts ...ToStringDeepOpts) string
ToStringDeep dumps the object and its descendants as text.
Flutter: foundation/diagnostics.dart DiagnosticableTree.toStringDeep
func ToStringShallow ¶
func ToStringShallow(d Diagnosticable, opts ...ToStringShallowOpts) string
ToStringShallow returns a string describing the object and its properties, without its children. The properties are joined with joiner (the default is ", ") and those less important than minLevel (the default is debug) are left out. Release builds give DiagnosticableString.
Flutter: foundation/diagnostics.dart DiagnosticableTree.toStringShallow
func ToStringShort ¶
ToStringShort is a brief description of the object: its ToStringShort method if it has one, and its type and ShortHash otherwise ("Foo#1a2b3").
Flutter: foundation/diagnostics.dart Diagnosticable.toStringShort
func TraceEnabled ¶
func TraceEnabled() bool
TraceEnabled says whether a trace is being recorded, so that the arguments of a TraceLog are made only when they will be kept.
Flutter: no counterpart
func TraceLog ¶
func TraceLog(category, message string)
TraceLog adds a message with a category to the trace, if one is recording.
Flutter: dart:developer Timeline.instantSync
func ValuesEqual ¶
ValuesEqual is Dart's `==` for two values: Go equality for values that can be compared, and identity for slices, maps and functions. A type with its own notion of equality (a pointer to a struct, say) needs a function of its own.
Flutter: no counterpart (the == operator)
Types ¶
type ChangeNotifier ¶
type ChangeNotifier struct {
// contains filtered or unexported fields
}
ChangeNotifier is a class that can be extended or embedded to provide a change notification API using AddListener and RemoveListener.
Embed it in a struct and call NotifyListeners when the struct changes. The zero value is ready to use. A ChangeNotifier must not be copied after first use. Only the UI thread may use it (SPEC §13).
Listeners may add and remove listeners, including themselves, while they run: a listener added during a notification is not called in that notification, and one removed during it is not called afterwards.
Flutter: foundation/change_notifier.dart ChangeNotifier
func NewChangeNotifier ¶
func NewChangeNotifier() *ChangeNotifier
NewChangeNotifier creates a ChangeNotifier. The zero value works too; this constructor is for a notifier used on its own.
Flutter: foundation/change_notifier.dart ChangeNotifier.new
func (*ChangeNotifier) AddListener ¶
func (n *ChangeNotifier) AddListener(listener VoidCallback) ListenerHandle
AddListener registers a function to be called when the object changes. It can be called again with the same function: it is then called once per registration.
Flutter: foundation/change_notifier.dart ChangeNotifier.addListener
func (*ChangeNotifier) DebugAssertNotDisposed ¶
func (n *ChangeNotifier) DebugAssertNotDisposed() bool
DebugAssertNotDisposed panics with the tag ChangeNotifierUsedAfterDispose in debug builds when Dispose has been called, and returns true. Other builds do nothing.
Flutter: foundation/change_notifier.dart ChangeNotifier.debugAssertNotDisposed
func (*ChangeNotifier) Dispose ¶
func (n *ChangeNotifier) Dispose()
Dispose discards any resources used by the object. After this is called, the object is not in a usable state (AddListener and NotifyListeners panic in debug builds). It panics with the tag ChangeNotifierDisposedWhileNotifying in debug builds when called from a listener.
Flutter: foundation/change_notifier.dart ChangeNotifier.dispose
func (*ChangeNotifier) HasListeners ¶
func (n *ChangeNotifier) HasListeners() bool
HasListeners reports whether any listeners are currently registered. A listener removed during a notification still counts until the notification is over.
Flutter: foundation/change_notifier.dart ChangeNotifier.hasListeners
func (*ChangeNotifier) NotifyListeners ¶
func (n *ChangeNotifier) NotifyListeners()
NotifyListeners calls all the registered listeners, in the order they were added.
Listeners added during the call are not called by it, and a listener removed during the call is not called after its removal.
A listener that panics does not stop the others. The panic is reported to the error reporter, if the notifier has one (SetErrorReporter), as a CallbackPanicked error; without a reporter the first panic goes on after the last listener was called. In debug builds, a notifier that has a UI thread (SetUIThread) panics with the tag WrongThread when it is notified from another goroutine.
Flutter: foundation/change_notifier.dart ChangeNotifier.notifyListeners
func (*ChangeNotifier) RemoveListener ¶
func (n *ChangeNotifier) RemoveListener(handle ListenerHandle)
RemoveListener removes a registration made with AddListener. It is allowed on a disposed object, so that listeners can clean up after their owner.
Flutter: foundation/change_notifier.dart ChangeNotifier.removeListener
func (*ChangeNotifier) SetErrorReporter ¶
func (n *ChangeNotifier) SetErrorReporter(r ErrorReporter)
SetErrorReporter sets the function that receives the panics of listeners. The owner of the notifier (the binding, a controller) sets it. Without one, a listener that panics does not stop the others, and the first panic goes on when the last one has been called.
Flutter: foundation/change_notifier.dart ChangeNotifier.notifyListeners
func (*ChangeNotifier) SetUIThread ¶
func (n *ChangeNotifier) SetUIThread(t *UIThread)
SetUIThread makes debug builds check that NotifyListeners is called from the UI thread, with the tag WrongThread (SPEC §13).
Flutter: no counterpart
type DiagnosticLevel ¶
type DiagnosticLevel int
DiagnosticLevel is the severity of a diagnostic: how interesting it is, and so whether a given dump shows it. The levels are ordered from the least to the most important; a dump shows the nodes at or above its minimum level.
Flutter: foundation/diagnostics.dart DiagnosticLevel
const ( // DiagnosticLevelUnspecified is the zero value: the default (info). // // Flutter: no counterpart DiagnosticLevelUnspecified DiagnosticLevel = iota // DiagnosticLevelHidden is a diagnostic that is not shown, unless a dump // asks for hidden ones. // // Flutter: foundation/diagnostics.dart DiagnosticLevel.hidden DiagnosticLevelHidden // DiagnosticLevelFine is a diagnostic that is only shown in the most // verbose dumps, such as a property that has its default value. // // Flutter: foundation/diagnostics.dart DiagnosticLevel.fine DiagnosticLevelFine // DiagnosticLevelDebug is a diagnostic useful when debugging. // // Flutter: foundation/diagnostics.dart DiagnosticLevel.debug DiagnosticLevelDebug // DiagnosticLevelInfo is a diagnostic with ordinary information. // // Flutter: foundation/diagnostics.dart DiagnosticLevel.info DiagnosticLevelInfo // DiagnosticLevelWarning is a diagnostic that something may be wrong. // // Flutter: foundation/diagnostics.dart DiagnosticLevel.warning DiagnosticLevelWarning // DiagnosticLevelHint is a diagnostic that tells how to fix a problem. // // Flutter: foundation/diagnostics.dart DiagnosticLevel.hint DiagnosticLevelHint // DiagnosticLevelSummary is a short summary of a problem. // // Flutter: foundation/diagnostics.dart DiagnosticLevel.summary DiagnosticLevelSummary // DiagnosticLevelError is a diagnostic for an error. // // Flutter: foundation/diagnostics.dart DiagnosticLevel.error DiagnosticLevelError // DiagnosticLevelOff is a level above every diagnostic: a dump at this // level shows nothing. // // Flutter: foundation/diagnostics.dart DiagnosticLevel.off DiagnosticLevelOff )
The values of DiagnosticLevel follow Flutter's declaration order.
func (DiagnosticLevel) Name ¶
func (l DiagnosticLevel) Name() string
Name returns the name Dart's Enum.name gives the value, such as "info".
func (DiagnosticLevel) String ¶
func (l DiagnosticLevel) String() string
String returns the name Dart prints for the value, such as "DiagnosticLevel.info".
type DiagnosticPropertiesBuilder ¶
type DiagnosticPropertiesBuilder struct {
// Properties are the properties added so far.
//
// Flutter: foundation/diagnostics.dart DiagnosticPropertiesBuilder.properties
Properties []DiagnosticsNode
// DefaultDiagnosticsTreeStyle is the style the object is drawn in, unless
// the caller asks for another. It starts as DiagnosticsTreeStyleSparse.
//
// Flutter: foundation/diagnostics.dart DiagnosticPropertiesBuilder.defaultDiagnosticsTreeStyle
DefaultDiagnosticsTreeStyle DiagnosticsTreeStyle
// EmptyBodyDescription is drawn for an object that has no properties and
// no children.
//
// Flutter: foundation/diagnostics.dart DiagnosticPropertiesBuilder.emptyBodyDescription
EmptyBodyDescription Opt[string]
}
DiagnosticPropertiesBuilder collects the properties of an object for DebugFillProperties.
Flutter: foundation/diagnostics.dart DiagnosticPropertiesBuilder
func NewDiagnosticPropertiesBuilder ¶
func NewDiagnosticPropertiesBuilder() *DiagnosticPropertiesBuilder
NewDiagnosticPropertiesBuilder creates an empty builder.
Flutter: foundation/diagnostics.dart DiagnosticPropertiesBuilder.new
func NewDiagnosticPropertiesBuilderFromProperties ¶
func NewDiagnosticPropertiesBuilderFromProperties(properties []DiagnosticsNode) *DiagnosticPropertiesBuilder
NewDiagnosticPropertiesBuilderFromProperties creates a builder that starts with the given properties.
Flutter: foundation/diagnostics.dart DiagnosticPropertiesBuilder.fromProperties
func (*DiagnosticPropertiesBuilder) Add ¶
func (b *DiagnosticPropertiesBuilder) Add(property DiagnosticsNode)
Add adds a property. Release builds ignore it.
Flutter: foundation/diagnostics.dart DiagnosticPropertiesBuilder.add
type Diagnosticable ¶
type Diagnosticable interface {
// DebugFillProperties adds the properties of the object to the builder.
//
// Flutter: foundation/diagnostics.dart Diagnosticable.debugFillProperties
DebugFillProperties(properties *DiagnosticPropertiesBuilder)
}
Diagnosticable is an object that can describe its properties for debug output. Implement DebugFillProperties and add a property for each field worth showing; call the embedded type's DebugFillProperties first, as Flutter calls super.
An object can also have a ToStringShort() string method (see ShortDescriber), and a DebugDescribeChildren() []DiagnosticsNode method makes it a DiagnosticableTree.
Flutter: foundation/diagnostics.dart Diagnosticable
type DiagnosticableNode ¶
type DiagnosticableNode struct {
DiagnosticsNodeBase
// contains filtered or unexported fields
}
DiagnosticableNode is the node that describes a Diagnosticable object: its description is the object's ToStringShort and its properties come from DebugFillProperties. For a DiagnosticableTree its children come from DebugDescribeChildren.
Flutter: foundation/diagnostics.dart DiagnosticableNode
func NewDiagnosticableNode ¶
func NewDiagnosticableNode(value Diagnosticable, opts ...DiagnosticsNodeOpts) *DiagnosticableNode
NewDiagnosticableNode creates a node for an object.
Flutter: foundation/diagnostics.dart DiagnosticableNode.new
func NewDiagnosticableTreeNode ¶
func NewDiagnosticableTreeNode(value DiagnosticableTree, opts ...DiagnosticsNodeOpts) *DiagnosticableNode
NewDiagnosticableTreeNode creates a node for an object with children.
Flutter: foundation/diagnostics.dart DiagnosticableTreeNode.new
func (*DiagnosticableNode) EmptyBodyDescription ¶
func (n *DiagnosticableNode) EmptyBodyDescription() Opt[string]
EmptyBodyDescription is what the object chose to draw when it has nothing else.
func (*DiagnosticableNode) GetChildren ¶
func (n *DiagnosticableNode) GetChildren() []DiagnosticsNode
GetChildren returns the children of a tree object.
func (*DiagnosticableNode) GetProperties ¶
func (n *DiagnosticableNode) GetProperties() []DiagnosticsNode
GetProperties returns the properties the object added.
func (*DiagnosticableNode) Style ¶
func (n *DiagnosticableNode) Style() DiagnosticsTreeStyle
Style is the style given to the node, or the one the object chose in DebugFillProperties; release builds draw nothing.
func (*DiagnosticableNode) ToDescription ¶
func (n *DiagnosticableNode) ToDescription(*TextTreeConfiguration) string
ToDescription is the ToStringShort of the object.
func (*DiagnosticableNode) Value ¶
func (n *DiagnosticableNode) Value() any
Value is the object the node describes.
type DiagnosticableTree ¶
type DiagnosticableTree interface {
Diagnosticable
// DebugDescribeChildren returns the children of the object as nodes.
//
// Flutter: foundation/diagnostics.dart DiagnosticableTree.debugDescribeChildren
DebugDescribeChildren() []DiagnosticsNode
}
DiagnosticableTree is a Diagnosticable that has children, which form a tree when dumped.
Flutter: foundation/diagnostics.dart DiagnosticableTree
type DiagnosticsBlock ¶
type DiagnosticsBlock struct {
DiagnosticsNodeBase
// contains filtered or unexported fields
}
DiagnosticsBlock is a node with fixed properties and children, to group text in a dump.
Flutter: foundation/diagnostics.dart DiagnosticsBlock
func NewDiagnosticsBlock ¶
func NewDiagnosticsBlock(opts ...DiagnosticsBlockOpts) *DiagnosticsBlock
NewDiagnosticsBlock creates a block.
Flutter: foundation/diagnostics.dart DiagnosticsBlock.new
func (*DiagnosticsBlock) AllowTruncate ¶
func (b *DiagnosticsBlock) AllowTruncate() bool
AllowTruncate is whether the properties and children may be cut short.
func (*DiagnosticsBlock) GetChildren ¶
func (b *DiagnosticsBlock) GetChildren() []DiagnosticsNode
GetChildren returns the children of the block.
func (*DiagnosticsBlock) GetProperties ¶
func (b *DiagnosticsBlock) GetProperties() []DiagnosticsNode
GetProperties returns the properties of the block.
func (*DiagnosticsBlock) Level ¶
func (b *DiagnosticsBlock) Level() DiagnosticLevel
Level is the importance of the block.
func (*DiagnosticsBlock) ToDescription ¶
func (b *DiagnosticsBlock) ToDescription(*TextTreeConfiguration) string
ToDescription is the description of the block.
func (*DiagnosticsBlock) Value ¶
func (b *DiagnosticsBlock) Value() any
Value is the object the block describes, if any.
type DiagnosticsBlockOpts ¶
type DiagnosticsBlockOpts struct {
// Name is the name of the block.
Name Opt[string]
// Style is how the block is drawn; the default is whitespace.
Style DiagnosticsTreeStyle
// ShowName is whether the name is drawn; the default is true. A block
// without a name never shows one.
ShowName Opt[bool]
// ShowSeparator is whether a colon follows the name; the default is true.
ShowSeparator Opt[bool]
// LinePrefix is text added before every line of the block.
LinePrefix Opt[string]
// Value is the object the block describes, if any.
Value any
// Description is the description of the block.
Description string
// Level is the importance of the block; the default is info.
Level DiagnosticLevel
// AllowTruncate is whether the properties and children may be cut short.
AllowTruncate bool
// Children are the children of the block.
Children []DiagnosticsNode
// Properties are the properties of the block.
Properties []DiagnosticsNode
}
DiagnosticsBlockOpts are the optional parameters of NewDiagnosticsBlock.
Flutter: foundation/diagnostics.dart DiagnosticsBlock.new
type DiagnosticsNode ¶
type DiagnosticsNode interface {
// Name is the name of the node, such as the name of a property. It does
// not end with a colon, which is added when the node is drawn.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.name
Name() Opt[string]
// ShowName is whether the name is drawn.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.showName
ShowName() bool
// ShowSeparator is whether a colon follows the name.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.showSeparator
ShowSeparator() bool
// LinePrefix is text added before every line of the node.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.linePrefix
LinePrefix() Opt[string]
// Style is how the node is drawn as text.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.style
Style() DiagnosticsTreeStyle
// Level is the importance of the node.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.level
Level() DiagnosticLevel
// Value is the object the node describes, or nil.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.value
Value() any
// EmptyBodyDescription is what to draw for a node that has no properties
// and no children, if anything.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.emptyBodyDescription
EmptyBodyDescription() Opt[string]
// AllowWrap is whether the description may wrap over several lines.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.allowWrap
AllowWrap() bool
// AllowNameWrap is whether the name may wrap over several lines.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.allowNameWrap
AllowNameWrap() bool
// AllowTruncate is whether the properties and children may be cut short.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.allowTruncate
AllowTruncate() bool
// ToDescription is the description of the node, without its name.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.toDescription
ToDescription(parentConfiguration *TextTreeConfiguration) string
// GetProperties returns the properties of the node.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.getProperties
GetProperties() []DiagnosticsNode
// GetChildren returns the children of the node.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.getChildren
GetChildren() []DiagnosticsNode
// IsFiltered reports whether the node is less important than minLevel
// (every node is in release builds).
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.isFiltered
IsFiltered(minLevel DiagnosticLevel) bool
// TextTreeConfiguration is the configuration for the node's style, or nil
// for DiagnosticsTreeStyleNone.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.textTreeConfiguration
TextTreeConfiguration() *TextTreeConfiguration
// ToStringDeep dumps the node and its subtree as text.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.toStringDeep
ToStringDeep(opts ...ToStringDeepOpts) string
// ToStringWith describes the node on one line, or a few, at a minimum
// level.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.toString
ToStringWith(parentConfiguration *TextTreeConfiguration, minLevel DiagnosticLevel) string
// String is ToStringWith with no parent and the info level.
//
// Flutter: foundation/diagnostics.dart DiagnosticsNode.toString
String() string
}
DiagnosticsNode is a description of a node of a tree of diagnostics: an object, a property of an object or a block of text. A tree of nodes is dumped as text with ToStringDeep.
Embed DiagnosticsNodeBase to make a node of your own, and call InitDiagnosticsNodeBase in its constructor.
Flutter: foundation/diagnostics.dart DiagnosticsNode
func ToDiagnosticsNode ¶
func ToDiagnosticsNode(d Diagnosticable, opts ...DiagnosticsNodeOpts) DiagnosticsNode
ToDiagnosticsNode returns a node that describes the object.
Flutter: foundation/diagnostics.dart Diagnosticable.toDiagnosticsNode
type DiagnosticsNodeBase ¶
type DiagnosticsNodeBase struct {
// contains filtered or unexported fields
}
DiagnosticsNodeBase holds the fields every DiagnosticsNode has and the methods that depend only on them. Embed it, and call InitDiagnosticsNodeBase with the outer node, so that the methods here reach the outer node's own versions of Level, Style, ToDescription and the others.
Flutter: foundation/diagnostics.dart DiagnosticsNode
func (*DiagnosticsNodeBase) AllowNameWrap ¶
func (b *DiagnosticsNodeBase) AllowNameWrap() bool
AllowNameWrap is false.
func (*DiagnosticsNodeBase) AllowTruncate ¶
func (b *DiagnosticsNodeBase) AllowTruncate() bool
AllowTruncate is false.
func (*DiagnosticsNodeBase) AllowWrap ¶
func (b *DiagnosticsNodeBase) AllowWrap() bool
AllowWrap is false.
func (*DiagnosticsNodeBase) EmptyBodyDescription ¶
func (b *DiagnosticsNodeBase) EmptyBodyDescription() Opt[string]
EmptyBodyDescription is None.
func (*DiagnosticsNodeBase) IsFiltered ¶
func (b *DiagnosticsNodeBase) IsFiltered(minLevel DiagnosticLevel) bool
IsFiltered reports whether the node is less important than minLevel (every node is in release builds).
func (*DiagnosticsNodeBase) Level ¶
func (b *DiagnosticsNodeBase) Level() DiagnosticLevel
Level is DiagnosticLevelInfo, and hidden in release builds.
func (*DiagnosticsNodeBase) LinePrefix ¶
func (b *DiagnosticsNodeBase) LinePrefix() Opt[string]
LinePrefix is text added before every line of the node.
func (*DiagnosticsNodeBase) Name ¶
func (b *DiagnosticsNodeBase) Name() Opt[string]
Name is the name of the node.
func (*DiagnosticsNodeBase) ShowName ¶
func (b *DiagnosticsNodeBase) ShowName() bool
ShowName is whether the name is drawn.
func (*DiagnosticsNodeBase) ShowSeparator ¶
func (b *DiagnosticsNodeBase) ShowSeparator() bool
ShowSeparator is whether a colon follows the name.
func (*DiagnosticsNodeBase) String ¶
func (b *DiagnosticsNodeBase) String() string
String is ToStringWith with no parent and the info level.
func (*DiagnosticsNodeBase) Style ¶
func (b *DiagnosticsNodeBase) Style() DiagnosticsTreeStyle
Style is how the node is drawn.
func (*DiagnosticsNodeBase) TextTreeConfiguration ¶
func (b *DiagnosticsNodeBase) TextTreeConfiguration() *TextTreeConfiguration
TextTreeConfiguration is the configuration for the node's style, or nil for DiagnosticsTreeStyleNone.
func (*DiagnosticsNodeBase) ToStringDeep ¶
func (b *DiagnosticsNodeBase) ToStringDeep(opts ...ToStringDeepOpts) string
ToStringDeep dumps the node and its subtree as text.
func (*DiagnosticsNodeBase) ToStringWith ¶
func (b *DiagnosticsNodeBase) ToStringWith(parentConfiguration *TextTreeConfiguration, minLevel DiagnosticLevel) string
ToStringWith describes the node on one line, or a few, at a minimum level.
type DiagnosticsNodeBaseOpts ¶
type DiagnosticsNodeBaseOpts struct {
// Name is the name of the node. It must not end with a colon, or
// InitDiagnosticsNodeBase panics with the tag DiagnosticsNameEndsWithColon
// in debug builds.
Name Opt[string]
// Style is how the node is drawn; the default is the one the node type
// chooses.
Style DiagnosticsTreeStyle
// ShowName is whether the name is drawn; the default is true.
ShowName Opt[bool]
// ShowSeparator is whether a colon follows the name; the default is true.
ShowSeparator Opt[bool]
// LinePrefix is text added before every line of the node.
LinePrefix Opt[string]
}
DiagnosticsNodeBaseOpts are the optional parameters of InitDiagnosticsNodeBase.
Flutter: foundation/diagnostics.dart DiagnosticsNode.new
type DiagnosticsNodeMessageOpts ¶
type DiagnosticsNodeMessageOpts struct {
// Style is how the message is drawn; the default is single line.
Style DiagnosticsTreeStyle
// Level is the importance of the message; the default is info.
Level DiagnosticLevel
// NoWrap stops the message from wrapping; Flutter's allowWrap is true by
// default.
NoWrap bool
}
DiagnosticsNodeMessageOpts are the optional parameters of NewDiagnosticsNodeMessage.
Flutter: foundation/diagnostics.dart DiagnosticsNode.message
type DiagnosticsNodeOpts ¶
type DiagnosticsNodeOpts struct {
// Name is the name of the node.
Name Opt[string]
// Style is how the node is drawn; the default is the one the object's
// DebugFillProperties chooses.
Style DiagnosticsTreeStyle
}
DiagnosticsNodeOpts are the optional parameters of ToDiagnosticsNode.
Flutter: foundation/diagnostics.dart Diagnosticable.toDiagnosticsNode
type DiagnosticsNodeProvider ¶
type DiagnosticsNodeProvider interface {
ToDiagnosticsNode(opts DiagnosticsNodeOpts) DiagnosticsNode
}
DiagnosticsNodeProvider is an object that makes its own diagnostics node, where the default one would not do. ToDiagnosticsNode uses it. A method of this kind must build the node with NewDiagnosticableNode or NewDiagnosticableTreeNode, not call ToDiagnosticsNode.
Flutter: foundation/diagnostics.dart Diagnosticable.toDiagnosticsNode
type DiagnosticsProperty ¶
type DiagnosticsProperty struct {
DiagnosticsNodeBase
// contains filtered or unexported fields
}
DiagnosticsProperty describes a property of an object: a name and a value, drawn as "name: value". The constructors NewStringProperty, NewDoubleProperty, NewFlagProperty and the others make properties that describe their value in their own way.
Deviation: all the property kinds are this one type, which the constructors configure; Flutter has a class for each (SPEC §12.10).
Flutter: foundation/diagnostics.dart DiagnosticsProperty
func NewDiagnosticsNodeMessage ¶
func NewDiagnosticsNodeMessage(message string, opts ...DiagnosticsNodeMessageOpts) *DiagnosticsProperty
NewDiagnosticsNodeMessage creates a node that shows a message. It is Flutter's DiagnosticsNode.message constructor.
Flutter: foundation/diagnostics.dart DiagnosticsNode.message
func NewDiagnosticsProperty ¶
func NewDiagnosticsProperty[T any](name string, value T, opts ...DiagnosticsPropertyOpts) *DiagnosticsProperty
NewDiagnosticsProperty creates a property with a name and a value of any type. A value that is nil (or a nil pointer, map, slice or function) is Dart's null.
Flutter: foundation/diagnostics.dart DiagnosticsProperty.new
func NewDiagnosticsPropertyLazy ¶
func NewDiagnosticsPropertyLazy[T any](name string, computeValue func() T, opts ...DiagnosticsPropertyOpts) *DiagnosticsProperty
NewDiagnosticsPropertyLazy creates a property whose value is computed when it is first needed. If computing panics, the property shows the panic as its exception instead of a value, and has the error level.
Flutter: foundation/diagnostics.dart DiagnosticsProperty.lazy
func NewDiagnosticsPropertyOpt ¶
func NewDiagnosticsPropertyOpt[T any](name string, value Opt[T], opts ...DiagnosticsPropertyOpts) *DiagnosticsProperty
NewDiagnosticsPropertyOpt creates a property whose value is None for Dart's null, where the type of the value has no nil of its own (a bool, a number or a struct).
Flutter: foundation/diagnostics.dart DiagnosticsProperty.new
func NewDoubleProperty ¶
func NewDoubleProperty(name string, value Opt[float64], opts ...NumberPropertyOpts) *DiagnosticsProperty
NewDoubleProperty creates a property that describes a number with one decimal. The value is None for Dart's null.
Flutter: foundation/diagnostics.dart DoubleProperty.new
func NewDoublePropertyLazy ¶
func NewDoublePropertyLazy(name string, computeValue func() Opt[float64], opts ...NumberPropertyOpts) *DiagnosticsProperty
NewDoublePropertyLazy creates a DoubleProperty whose value is computed when it is first needed.
Flutter: foundation/diagnostics.dart DoubleProperty.lazy
func NewEnumProperty ¶
func NewEnumProperty[T EnumValue](name string, value Opt[T], opts ...EnumPropertyOpts) *DiagnosticsProperty
NewEnumProperty creates a property that describes an enum value by its name. The value is None for Dart's null.
Flutter: foundation/diagnostics.dart EnumProperty.new
func NewFlagProperty ¶
func NewFlagProperty(name string, value Opt[bool], opts ...FlagPropertyOpts) *DiagnosticsProperty
NewFlagProperty creates a property that describes a boolean flag by a phrase for each value, such as "has focus". The value is None for Dart's null. At least one of IfTrue and IfFalse must be set, or it panics with the tag FlagPropertyNoDescription in debug builds.
Flutter: foundation/diagnostics.dart FlagProperty.new
func NewFlagsSummary ¶
func NewFlagsSummary(name string, entries []FlagEntry, opts ...FlagsSummaryOpts) *DiagnosticsProperty
NewFlagsSummary creates a property that lists the descriptions of the entries that are present, such as the states of a button. The entries keep their order (Flutter's map keeps its insertion order).
Flutter: foundation/diagnostics.dart FlagsSummary.new
func NewIntProperty ¶
func NewIntProperty(name string, value Opt[int], opts ...NumberPropertyOpts) *DiagnosticsProperty
NewIntProperty creates a property that describes an integer. The value is None for Dart's null.
Flutter: foundation/diagnostics.dart IntProperty.new
func NewIterableProperty ¶
func NewIterableProperty[T any](name string, value []T, opts ...IterablePropertyOpts) *DiagnosticsProperty
NewIterableProperty creates a property that describes a list of values. Float values are formatted with DebugFormatDouble. The value is a slice; nil is Dart's null.
Flutter: foundation/diagnostics.dart IterableProperty.new
func NewMessageProperty ¶
func NewMessageProperty(name, message string, opts ...MessagePropertyOpts) *DiagnosticsProperty
NewMessageProperty creates a property whose description is a message.
Flutter: foundation/diagnostics.dart MessageProperty.new
func NewObjectFlagProperty ¶
func NewObjectFlagProperty[T any](name string, value T, opts ...ObjectFlagPropertyOpts) *DiagnosticsProperty
NewObjectFlagProperty creates a property that describes whether an object is there, by a phrase for each case, such as "has a callback". At least one of IfPresent and IfNull must be set, or it panics with the tag ObjectFlagPropertyNoDescription in debug builds.
Flutter: foundation/diagnostics.dart ObjectFlagProperty.new
func NewObjectFlagPropertyHas ¶
func NewObjectFlagPropertyHas[T any](name string, value T, level ...DiagnosticLevel) *DiagnosticsProperty
NewObjectFlagPropertyHas creates an ObjectFlagProperty that reads "has <name>" when the value is not nil and shows nothing otherwise.
Flutter: foundation/diagnostics.dart ObjectFlagProperty.has
func NewPercentProperty ¶
func NewPercentProperty(name string, fraction Opt[float64], opts ...NumberPropertyOpts) *DiagnosticsProperty
NewPercentProperty creates a property that describes a fraction as a percentage with one decimal ("37.5%"), clamped to 0 through 100. The value is None for Dart's null.
Flutter: foundation/diagnostics.dart PercentProperty.new
func NewStringProperty ¶
func NewStringProperty(name string, value Opt[string], opts ...StringPropertyOpts) *DiagnosticsProperty
NewStringProperty creates a property that describes a string, in quotes. The value is None for Dart's null.
Flutter: foundation/diagnostics.dart StringProperty.new
func (*DiagnosticsProperty) AllowNameWrap ¶
func (p *DiagnosticsProperty) AllowNameWrap() bool
AllowNameWrap is whether the name may wrap.
func (*DiagnosticsProperty) AllowWrap ¶
func (p *DiagnosticsProperty) AllowWrap() bool
AllowWrap is whether the description may wrap.
func (*DiagnosticsProperty) DefaultValue ¶
func (p *DiagnosticsProperty) DefaultValue() (any, bool)
DefaultValue is the value that is not interesting, and whether there is one.
Flutter: foundation/diagnostics.dart DiagnosticsProperty.defaultValue
func (*DiagnosticsProperty) Exception ¶
func (p *DiagnosticsProperty) Exception() any
Exception is what computing the value panicked with, or nil.
Flutter: foundation/diagnostics.dart DiagnosticsProperty.exception
func (*DiagnosticsProperty) GetChildren ¶
func (p *DiagnosticsProperty) GetChildren() []DiagnosticsNode
GetChildren returns the children of the value when ExpandableValue was set and the value can describe itself.
func (*DiagnosticsProperty) GetProperties ¶
func (p *DiagnosticsProperty) GetProperties() []DiagnosticsNode
GetProperties returns the properties of the value when ExpandableValue was set and the value can describe itself.
func (*DiagnosticsProperty) IfEmpty ¶
func (p *DiagnosticsProperty) IfEmpty() Opt[string]
IfEmpty is the description of a value that describes as an empty string, if any.
Flutter: foundation/diagnostics.dart DiagnosticsProperty.ifEmpty
func (*DiagnosticsProperty) IfNull ¶
func (p *DiagnosticsProperty) IfNull() Opt[string]
IfNull is the description of a null value, if any.
Flutter: foundation/diagnostics.dart DiagnosticsProperty.ifNull
func (*DiagnosticsProperty) IsInteresting ¶
func (p *DiagnosticsProperty) IsInteresting() bool
IsInteresting is whether the value differs from the default value, or there is none.
Flutter: foundation/diagnostics.dart DiagnosticsProperty.isInteresting
func (*DiagnosticsProperty) Level ¶
func (p *DiagnosticsProperty) Level() DiagnosticLevel
Level is the importance of the property: hidden when it was created hidden, error when computing its value panicked, warning for a missing value, fine for a value that is not interesting and its own level otherwise.
func (*DiagnosticsProperty) MissingIfNull ¶
func (p *DiagnosticsProperty) MissingIfNull() bool
MissingIfNull is whether a nil value is a warning.
Flutter: foundation/diagnostics.dart DiagnosticsProperty.missingIfNull
func (*DiagnosticsProperty) PropertyType ¶
func (p *DiagnosticsProperty) PropertyType() string
PropertyType is the name of the type of the value.
Flutter: foundation/diagnostics.dart DiagnosticsProperty.propertyType
func (*DiagnosticsProperty) ShowName ¶
func (p *DiagnosticsProperty) ShowName() bool
ShowName is whether the name is drawn.
func (*DiagnosticsProperty) ToDescription ¶
func (p *DiagnosticsProperty) ToDescription(parent *TextTreeConfiguration) string
ToDescription is the description of the property, without its name.
func (*DiagnosticsProperty) Tooltip ¶
func (p *DiagnosticsProperty) Tooltip() Opt[string]
Tooltip is shown after the description in parentheses, if any.
Flutter: foundation/diagnostics.dart DiagnosticsProperty.tooltip
func (*DiagnosticsProperty) TypeName ¶
func (p *DiagnosticsProperty) TypeName() string
TypeName is the name of Flutter's class that this property stands for, such as "StringProperty".
func (*DiagnosticsProperty) Value ¶
func (p *DiagnosticsProperty) Value() any
Value is the value of the property, computed on first use when the property is lazy. A nil result is Dart's null.
Flutter: foundation/diagnostics.dart DiagnosticsProperty.value
func (*DiagnosticsProperty) ValueToString ¶
func (p *DiagnosticsProperty) ValueToString(parent *TextTreeConfiguration) string
ValueToString describes the value of the property.
Flutter: foundation/diagnostics.dart DiagnosticsProperty.valueToString
type DiagnosticsPropertyOpts ¶
type DiagnosticsPropertyOpts struct {
// Description replaces the description made from the value.
Description string
// IfNull is the description of a nil value.
IfNull string
// IfEmpty is the description of a value that describes as an empty string.
IfEmpty string
// ShowName is whether the name is drawn; the default is true.
ShowName Opt[bool]
// ShowSeparator is whether a colon follows the name; the default is true.
ShowSeparator Opt[bool]
// DefaultValue is the value that is not interesting: the property is
// hidden from most dumps when it has this value. Leave it nil for none, and
// use DefaultNull when the default is Dart's null.
DefaultValue any
// Tooltip is added after the description in parentheses.
Tooltip string
// MissingIfNull makes a nil value a warning that reads "MISSING".
MissingIfNull bool
// LinePrefix is text added before every line of the node.
LinePrefix string
// ExpandableValue shows the properties and children of the value under
// this property.
ExpandableValue bool
// NoWrap stops the description from wrapping; Flutter's allowWrap is true
// by default.
NoWrap bool
// NoNameWrap stops the name from wrapping; Flutter's allowNameWrap is
// true by default.
NoNameWrap bool
// Style is how the property is drawn; the default is single line.
Style DiagnosticsTreeStyle
// Level is the importance of the property; the default is info.
Level DiagnosticLevel
// ValueToString replaces the description of the value, as an override of
// DiagnosticsProperty.valueToString does in Dart. It gets the configuration
// of the parent node.
ValueToString func(parent *TextTreeConfiguration) string
}
DiagnosticsPropertyOpts are the optional parameters of the property constructors that describe any value.
A string that is empty means null in Dart: it is not used.
Flutter: foundation/diagnostics.dart DiagnosticsProperty.new
type DiagnosticsTreeStyle ¶
type DiagnosticsTreeStyle int
DiagnosticsTreeStyle is the style in which a tree of diagnostics nodes is drawn as text: how its branches, properties and children are laid out.
Flutter: foundation/diagnostics.dart DiagnosticsTreeStyle
const ( // DiagnosticsTreeStyleUnspecified is the zero value: the node's default // style. // // Flutter: no counterpart (Dart's null) DiagnosticsTreeStyleUnspecified DiagnosticsTreeStyle = iota // DiagnosticsTreeStyleNone does not draw the node as text. // // Flutter: foundation/diagnostics.dart DiagnosticsTreeStyle.none DiagnosticsTreeStyleNone // DiagnosticsTreeStyleSparse draws a tree with lines and a blank line // after a node with properties and no children. // // Flutter: foundation/diagnostics.dart DiagnosticsTreeStyle.sparse DiagnosticsTreeStyleSparse // DiagnosticsTreeStyleOffstage draws a node that is not on the screen // with dashes. // // Flutter: foundation/diagnostics.dart DiagnosticsTreeStyle.offstage DiagnosticsTreeStyleOffstage // DiagnosticsTreeStyleDense draws a tree without blank lines and with the // properties on the line of the description. // // Flutter: foundation/diagnostics.dart DiagnosticsTreeStyle.dense DiagnosticsTreeStyleDense // DiagnosticsTreeStyleTransition draws a subtree in a box, for a node // that is in transition. // // Flutter: foundation/diagnostics.dart DiagnosticsTreeStyle.transition DiagnosticsTreeStyleTransition // DiagnosticsTreeStyleError draws an error message in a box. // // Flutter: foundation/diagnostics.dart DiagnosticsTreeStyle.error DiagnosticsTreeStyleError // DiagnosticsTreeStyleWhitespace draws a tree with indentation instead of // lines. // // Flutter: foundation/diagnostics.dart DiagnosticsTreeStyle.whitespace DiagnosticsTreeStyleWhitespace // DiagnosticsTreeStyleFlat draws a tree without indentation. // // Flutter: foundation/diagnostics.dart DiagnosticsTreeStyle.flat DiagnosticsTreeStyleFlat // DiagnosticsTreeStyleSingleLine draws the node on one line, as a // property usually is. // // Flutter: foundation/diagnostics.dart DiagnosticsTreeStyle.singleLine DiagnosticsTreeStyleSingleLine // DiagnosticsTreeStyleErrorProperty draws a property of an error message. // // Flutter: foundation/diagnostics.dart DiagnosticsTreeStyle.errorProperty DiagnosticsTreeStyleErrorProperty // DiagnosticsTreeStyleShallow draws a node without its children. // // Flutter: foundation/diagnostics.dart DiagnosticsTreeStyle.shallow DiagnosticsTreeStyleShallow // DiagnosticsTreeStyleTruncateChildren draws a short list of the // descendants of the node. // // Flutter: foundation/diagnostics.dart DiagnosticsTreeStyle.truncateChildren DiagnosticsTreeStyleTruncateChildren )
The values of DiagnosticsTreeStyle follow Flutter's declaration order.
func (DiagnosticsTreeStyle) Name ¶
func (s DiagnosticsTreeStyle) Name() string
Name returns the name Dart's Enum.name gives the value, such as "sparse".
func (DiagnosticsTreeStyle) String ¶
func (s DiagnosticsTreeStyle) String() string
String returns the name Dart prints for the value, such as "DiagnosticsTreeStyle.sparse".
type EnumPropertyOpts ¶
type EnumPropertyOpts struct {
// DefaultValue is the value that is not interesting; see
// DiagnosticsPropertyOpts.
DefaultValue any
// Level is the importance of the property; the default is info.
Level DiagnosticLevel
}
EnumPropertyOpts are the optional parameters of NewEnumProperty.
Flutter: foundation/diagnostics.dart EnumProperty.new
type EnumValue ¶
type EnumValue interface {
comparable
Name() string
}
EnumValue is a value of an enum type that can name itself, as Dart's Enum.name does. The enum types of Glutter have a Name method.
Flutter: no counterpart
type ErrorReporter ¶
type ErrorReporter func(err error)
ErrorReporter receives the errors that the framework recovers from instead of letting them end the program: a panic in a Build method, in layout or paint, in a callback or a listener. The binding passes one to every part of the framework. The default of RunApp logs the error with its ToJson through the app's logger (SPEC §14.2).
Flutter: foundation/assertions.dart FlutterError.onError
type FlagEntry ¶
type FlagEntry struct {
// Description is shown when Present is true.
Description string
// Present is whether the entry has a value.
Present bool
}
FlagEntry is one entry of a FlagsSummary: a description and whether it applies (Flutter's non-null value).
Flutter: no counterpart
type FlagPropertyOpts ¶
type FlagPropertyOpts struct {
// IfTrue is the description when the flag is true.
IfTrue string
// IfFalse is the description when the flag is false.
IfFalse string
// ShowName is whether the name is drawn next to the description.
ShowName bool
// DefaultValue is the value that is not interesting; see
// DiagnosticsPropertyOpts.
DefaultValue any
// Level is the importance of the property; the default is info.
Level DiagnosticLevel
}
FlagPropertyOpts are the optional parameters of NewFlagProperty.
Flutter: foundation/diagnostics.dart FlagProperty.new
type FlagsSummaryOpts ¶
type FlagsSummaryOpts struct {
// IfEmpty is the description when no entry has a value.
IfEmpty string
// ShowName is whether the name is drawn; the default is true.
ShowName Opt[bool]
// ShowSeparator is whether a colon follows the name; the default is true.
ShowSeparator Opt[bool]
// Level is the importance of the property; the default is info.
Level DiagnosticLevel
}
FlagsSummaryOpts are the optional parameters of NewFlagsSummary.
Flutter: foundation/diagnostics.dart FlagsSummary.new
type IterablePropertyOpts ¶
type IterablePropertyOpts struct {
// DefaultValue is the value that is not interesting; see
// DiagnosticsPropertyOpts.
DefaultValue any
// IfNull is the description of a nil value.
IfNull string
// IfEmpty is the description of an empty list; the default is "[]". Set
// NoIfEmpty to have none.
IfEmpty string
// NoIfEmpty removes the description of an empty list: the property then
// has the fine level when it is empty.
NoIfEmpty bool
// Style is how the property is drawn; the default is single line.
Style DiagnosticsTreeStyle
// ShowName is whether the name is drawn; the default is true.
ShowName Opt[bool]
// ShowSeparator is whether a colon follows the name; the default is true.
ShowSeparator Opt[bool]
// Level is the importance of the property; the default is info.
Level DiagnosticLevel
}
IterablePropertyOpts are the optional parameters of NewIterableProperty.
Flutter: foundation/diagnostics.dart IterableProperty.new
type Key ¶
type Key interface {
// String describes the key for debug output, such as "[<'title'>]".
String() string
// contains filtered or unexported methods
}
Key is an identifier for widgets, elements and semantic nodes. A widget with a key replaces a widget of the same type with an equal key instead of updating the one at its position.
Two keys are the same key when they are equal under Go's == operator, so keys work as map keys. A key type of your own embeds KeyBase (or LocalKeyBase) and must be comparable.
Flutter: foundation/key.dart Key
type KeyBase ¶
type KeyBase struct{}
KeyBase marks a type as a Key. Embed it in a key type.
Flutter: foundation/key.dart Key.empty
type Listenable ¶
type Listenable interface {
// AddListener registers a function to be called when the object changes
// and returns the handle that removes it again.
//
// Flutter: foundation/change_notifier.dart Listenable.addListener
AddListener(listener VoidCallback) ListenerHandle
// RemoveListener removes a registration made with AddListener. Removing a
// handle that is not registered (or twice) does nothing.
//
// Flutter: foundation/change_notifier.dart Listenable.removeListener
RemoveListener(handle ListenerHandle)
}
Listenable is an object that maintains a list of listeners. The listeners are typically used to notify clients that the object has been updated.
Flutter: foundation/change_notifier.dart Listenable
func MergeListenables ¶
func MergeListenables(listenables ...Listenable) Listenable
MergeListenables creates a Listenable that triggers when any of the given Listenables themselves trigger. A nil entry is skipped.
Flutter: foundation/change_notifier.dart Listenable.merge
type ListenerHandle ¶
type ListenerHandle struct {
// contains filtered or unexported fields
}
ListenerHandle identifies one registration made with Listenable.AddListener. Pass it to RemoveListener to undo that registration. The zero value identifies nothing, and removing it does nothing.
Deviation: Go functions cannot be compared, so AddListener returns a handle where Flutter's removeListener takes the listener itself (SPEC §12.10).
Flutter: no counterpart
type LocalKey ¶
type LocalKey interface {
Key
// contains filtered or unexported methods
}
LocalKey is a Key that is not a GlobalKey: it is unique only among the children of one parent.
Flutter: foundation/key.dart LocalKey
type LocalKeyBase ¶
type LocalKeyBase struct{ KeyBase }
LocalKeyBase marks a type as a LocalKey. Embed it in a local key type.
Flutter: foundation/key.dart LocalKey
type MessagePropertyOpts ¶
type MessagePropertyOpts struct {
// Style is how the property is drawn; the default is single line.
Style DiagnosticsTreeStyle
// Level is the importance of the property; the default is info.
Level DiagnosticLevel
}
MessagePropertyOpts are the optional parameters of NewMessageProperty.
Flutter: foundation/diagnostics.dart MessageProperty.new
type NumberPropertyOpts ¶
type NumberPropertyOpts struct {
// IfNull is the description of a null value.
IfNull string
// Unit is added after the number, such as "px".
Unit string
// Tooltip is added after the description in parentheses.
Tooltip string
// DefaultValue is the value that is not interesting; see
// DiagnosticsPropertyOpts.
DefaultValue any
// ShowName is whether the name is drawn; the default is true.
ShowName Opt[bool]
// Style is how the property is drawn; the default is single line.
Style DiagnosticsTreeStyle
// Level is the importance of the property; the default is info.
Level DiagnosticLevel
}
NumberPropertyOpts are the optional parameters of the number properties.
Flutter: foundation/diagnostics.dart DoubleProperty.new
type ObjectFlagPropertyOpts ¶
type ObjectFlagPropertyOpts struct {
// IfPresent is the description of a value that is not nil.
IfPresent string
// IfNull is the description of a nil value.
IfNull string
// ShowName is whether the name is drawn next to the description.
ShowName bool
// Level is the importance of the property; the default is info.
Level DiagnosticLevel
}
ObjectFlagPropertyOpts are the optional parameters of the object flag properties.
Flutter: foundation/diagnostics.dart ObjectFlagProperty.new
type ObjectKey ¶
type ObjectKey struct {
LocalKeyBase
// contains filtered or unexported fields
}
ObjectKey is a key that takes its identity from the object it was made from: two ObjectKeys are equal when they hold the same object (the same pointer, or equal values of a type that is not a pointer).
Flutter: widgets/framework.dart ObjectKey
func NewObjectKey ¶
NewObjectKey creates a key from an object. The object's type must be comparable (not a slice, map or function), or it panics with the tag ObjectKeyNotComparable.
Flutter: widgets/framework.dart ObjectKey.new
type Opt ¶
type Opt[T any] struct { // contains filtered or unexported fields }
Opt is an optional value: either a value (Some) or nothing (None, the zero value). It stands in for a nullable Flutter parameter whose null behaves differently from Go's zero value (SPEC §12.3).
Flutter: no counterpart (Dart's nullable types)
func DebugDefaultTargetPlatformOverride ¶
func DebugDefaultTargetPlatformOverride() Opt[TargetPlatform]
DebugDefaultTargetPlatformOverride returns the platform that replaces DefaultTargetPlatform, or None when there is no override.
Flutter: foundation/platform.dart debugDefaultTargetPlatformOverride
func None ¶
None returns an Opt that holds nothing, which is also the zero value.
Flutter: no counterpart (Dart's null)
func (Opt[T]) Get ¶
Get returns the value and whether there is one. Without a value it returns T's zero value and false.
type RenderOpts ¶
type RenderOpts struct {
// PrefixLineOne is added before the first line.
PrefixLineOne string
// PrefixOtherLines is added before the other lines; the default is
// PrefixLineOne.
PrefixOtherLines Opt[string]
// ParentConfiguration is the configuration of the parent, if any.
ParentConfiguration *TextTreeConfiguration
}
RenderOpts are the optional parameters of TextTreeRenderer.Render.
Flutter: foundation/diagnostics.dart TextTreeRenderer.render
type ShortDescriber ¶
type ShortDescriber interface {
ToStringShort() string
}
ShortDescriber is an object that describes itself in a few words. ToStringShort uses it.
Flutter: foundation/diagnostics.dart Diagnosticable.toStringShort
type StringPropertyOpts ¶
type StringPropertyOpts struct {
// Description replaces the description made from the value.
Description string
// Tooltip is added after the description in parentheses.
Tooltip string
// ShowName is whether the name is drawn; the default is true.
ShowName Opt[bool]
// DefaultValue is the value that is not interesting; see
// DiagnosticsPropertyOpts.
DefaultValue any
// Unquoted draws the string without quotes; Flutter's quoted is true by
// default.
Unquoted bool
// IfEmpty is the description of an empty string.
IfEmpty string
// Style is how the property is drawn; the default is single line.
Style DiagnosticsTreeStyle
// Level is the importance of the property; the default is info.
Level DiagnosticLevel
}
StringPropertyOpts are the optional parameters of NewStringProperty.
Flutter: foundation/diagnostics.dart StringProperty.new
type TargetPlatform ¶
type TargetPlatform int
TargetPlatform is the operating system the framework behaves like. Platform dependent framework behavior (scroll physics, shortcuts such as Ctrl or Cmd, menu conventions, typography) reads it instead of checking runtime.GOOS (SPEC §3).
Flutter: foundation/platform.dart TargetPlatform
const ( // TargetPlatformUnspecified is the zero value: the default target platform. // // Flutter: no counterpart TargetPlatformUnspecified TargetPlatform = iota // TargetPlatformAndroid is Android. // // Flutter: foundation/platform.dart TargetPlatform.android TargetPlatformAndroid // TargetPlatformFuchsia is Fuchsia. // // Flutter: foundation/platform.dart TargetPlatform.fuchsia TargetPlatformFuchsia // TargetPlatformIOS is iOS. // // Flutter: foundation/platform.dart TargetPlatform.iOS TargetPlatformIOS // TargetPlatformLinux is Linux. // // Flutter: foundation/platform.dart TargetPlatform.linux TargetPlatformLinux // TargetPlatformMacOS is macOS. // // Flutter: foundation/platform.dart TargetPlatform.macOS TargetPlatformMacOS // TargetPlatformWindows is Windows. // // Flutter: foundation/platform.dart TargetPlatform.windows TargetPlatformWindows )
The values of TargetPlatform follow Flutter's declaration order.
func DefaultTargetPlatform ¶
func DefaultTargetPlatform() TargetPlatform
DefaultTargetPlatform is the platform the framework behaves like. Debug builds let a test change it with SetDebugDefaultTargetPlatformOverride.
Flutter: foundation/platform.dart defaultTargetPlatform
func (TargetPlatform) Name ¶
func (p TargetPlatform) Name() string
Name returns the name Dart's Enum.name gives the value, such as "linux".
func (TargetPlatform) String ¶
func (p TargetPlatform) String() string
String returns the name Dart prints for the value, such as "TargetPlatform.linux".
type TextTreeConfiguration ¶
type TextTreeConfiguration struct {
// PrefixLineOne is the prefix of the first line of a child.
PrefixLineOne string
// SuffixLineOne is the suffix of the first line of the node.
SuffixLineOne string
// PrefixOtherLines is the prefix of the other lines of a child.
PrefixOtherLines string
// PrefixLastChildLineOne is the prefix of the first line of the last
// child.
PrefixLastChildLineOne string
// PrefixOtherLinesRootNode is the prefix of the other lines of the root
// node.
PrefixOtherLinesRootNode string
// PropertyPrefixIfChildren is the prefix of the properties of a node that
// has children.
PropertyPrefixIfChildren string
// PropertyPrefixNoChildren is the prefix of the properties of a node
// without children.
PropertyPrefixNoChildren string
// LinkCharacter is the string that links a node to its siblings below.
LinkCharacter string
// ChildLinkSpace is as much space as LinkCharacter takes.
ChildLinkSpace string
// LineBreak is what ends a line.
LineBreak string
// LineBreakProperties is whether each property is on its own line.
LineBreakProperties bool
// BeforeName is written before the name.
BeforeName string
// AfterName is written after the name.
AfterName string
// AfterDescriptionIfBody is written after the description of a node that
// has properties or children.
AfterDescriptionIfBody string
// AfterDescription is written after the description.
AfterDescription string
// BeforeProperties is written before the properties.
BeforeProperties string
// AfterProperties is written after the properties.
AfterProperties string
// MandatoryAfterProperties is written after the properties, even when
// there are none.
MandatoryAfterProperties string
// PropertySeparator separates the properties.
PropertySeparator string
// BodyIndent indents the properties and the children.
BodyIndent string
// ShowChildren is whether the children are drawn.
ShowChildren bool
// AddBlankLineIfNoChildren is whether a node without children is followed
// by a blank line.
AddBlankLineIfNoChildren bool
// IsNameOnOwnLine is whether the name has a line of its own.
IsNameOnOwnLine bool
Footer string
// the width of the text.
MandatoryFooter string
// IsBlankLineBetweenPropertiesAndChildren is whether a blank line
// separates the properties from the children.
IsBlankLineBetweenPropertiesAndChildren bool
}
TextTreeConfiguration configures how a DiagnosticsTreeStyle draws a tree as text. The configurations of the styles are the package values SparseTextConfiguration and the like; do not change them.
Flutter: foundation/diagnostics.dart TextTreeConfiguration
type TextTreeRenderer ¶
type TextTreeRenderer struct {
// contains filtered or unexported fields
}
TextTreeRenderer renders a tree of DiagnosticsNodes as text.
Flutter: foundation/diagnostics.dart TextTreeRenderer
func NewTextTreeRenderer ¶
func NewTextTreeRenderer(opts ...TextTreeRendererOpts) *TextTreeRenderer
NewTextTreeRenderer creates a renderer.
Flutter: foundation/diagnostics.dart TextTreeRenderer.new
func (*TextTreeRenderer) Render ¶
func (r *TextTreeRenderer) Render(node DiagnosticsNode, opts ...RenderOpts) string
Render renders the node and its subtree as text. Release builds render nothing.
Flutter: foundation/diagnostics.dart TextTreeRenderer.render
type TextTreeRendererOpts ¶
type TextTreeRendererOpts struct {
// MinLevel hides the properties less important than it; the default is
// DiagnosticLevelDebug.
MinLevel DiagnosticLevel
// WrapWidth is the width at which lines wrap; the default is 100.
WrapWidth int
// WrapWidthProperties is the width at which the properties of a node wrap
// when the prefix is long; the default is 65.
WrapWidthProperties int
// MaxDescendentsTruncatableNode is how many properties and children a
// node that may be truncated shows; the default (None) is all.
MaxDescendentsTruncatableNode Opt[int]
}
TextTreeRendererOpts are the optional parameters of NewTextTreeRenderer.
Flutter: foundation/diagnostics.dart TextTreeRenderer.new
type ToStringDeepOpts ¶
type ToStringDeepOpts struct {
// PrefixLineOne is added before the first line.
PrefixLineOne string
// PrefixOtherLines is added before the other lines; the default is
// PrefixLineOne.
PrefixOtherLines Opt[string]
// ParentConfiguration is the configuration of the parent, if any.
ParentConfiguration *TextTreeConfiguration
// MinLevel hides the properties less important than it; the default is
// DiagnosticLevelDebug.
MinLevel DiagnosticLevel
// WrapWidth is the width at which lines wrap; the default is 65.
WrapWidth int
}
ToStringDeepOpts are the optional parameters of ToStringDeep.
Flutter: foundation/diagnostics.dart DiagnosticsNode.toStringDeep
type ToStringShallowOpts ¶
type ToStringShallowOpts struct {
// Joiner separates the properties; the default is ", ".
Joiner string
// MinLevel leaves out the properties less important than it; the default
// is DiagnosticLevelDebug.
MinLevel DiagnosticLevel
}
ToStringShallowOpts are the optional parameters of ToStringShallow.
Flutter: foundation/diagnostics.dart DiagnosticableTree.toStringShallow
type TraceRegion ¶
type TraceRegion struct {
// contains filtered or unexported fields
}
TraceRegion is a span of the runtime execution trace (go tool trace, the "User-defined regions" view): the framework wraps the phases of a frame in regions named as Flutter's timeline events are (BUILD, LAYOUT, PAINT, and so on). A region costs one atomic load while no trace is being recorded.
Flutter: dart:developer Timeline.startSync
func StartTraceRegion ¶
func StartTraceRegion(name string) TraceRegion
StartTraceRegion starts a region with the name on the calling goroutine. End it on the same goroutine, usually with
defer foundation.StartTraceRegion("LAYOUT").End()
Flutter: dart:developer Timeline.startSync
func (TraceRegion) End ¶
func (r TraceRegion) End()
End ends the region; ending the region of a trace that was not recording does nothing.
Flutter: dart:developer TimelineTask.finish
type UIThread ¶
type UIThread struct {
// contains filtered or unexported fields
}
UIThread remembers which goroutine is the UI thread: the one that owns the element tree, the render tree and the engine (SPEC §13). The binding makes one when it is created, on the main goroutine, and hands it to the parts of the framework that check or branch on the calling goroutine.
The goroutine is known by its goid.Token, its number, which UIThread.IsCurrent compares in a couple of nanoseconds at any stack depth. The number is never given to a second goroutine, so once the UI goroutine has ended, no goroutine is the UI thread until another one calls UIThread.Adopt: a test driver that runs on a new goroutine adopts at each of its entry points.
Flutter: no counterpart (Dart code runs on one isolate)
func NewUIThread ¶
func NewUIThread() *UIThread
NewUIThread makes a UIThread for the calling goroutine.
Flutter: no counterpart
func (*UIThread) Adopt ¶
func (t *UIThread) Adopt()
Adopt makes the calling goroutine the UI thread. A goroutine that takes over from the one that was the UI thread must call it (see UIThread).
Flutter: no counterpart
func (*UIThread) AssertCurrent ¶
AssertCurrent panics with the tag WrongThread in debug builds when the calling goroutine is not the UI thread. what names the entry point that was called. Other builds do nothing. The numbers of the two goroutines in the error's metadata are read from runtime.Stack, after the check failed.
Flutter: no counterpart
type UniqueKey ¶
type UniqueKey struct {
LocalKeyBase
// contains filtered or unexported fields
}
UniqueKey is a key that is equal only to itself.
Flutter: foundation/key.dart UniqueKey
func NewUniqueKey ¶
func NewUniqueKey() *UniqueKey
NewUniqueKey creates a key that is equal only to itself. Compare keys by pointer; it is a *UniqueKey.
Flutter: foundation/key.dart UniqueKey.new
type ValueKey ¶
type ValueKey[T comparable] struct { LocalKeyBase // contains filtered or unexported fields }
ValueKey is a key that uses a value of a given type to identify itself. Two ValueKeys are equal when their values are equal.
Deviation: it is a plain value, not a pointer, so that == and map lookups compare the values (SPEC §12.10).
Flutter: foundation/key.dart ValueKey
func NewKey ¶
NewKey creates a key from a string. It is Flutter's `Key('value')`, a ValueKey of a string.
Flutter: foundation/key.dart Key.new
func NewValueKey ¶
func NewValueKey[T comparable](value T) ValueKey[T]
NewValueKey creates a key from a value.
Flutter: foundation/key.dart ValueKey.new
type ValueListenable ¶
type ValueListenable[T any] interface { Listenable // Value is the current value of the object. When it changes, the // listeners are called. // // Flutter: foundation/change_notifier.dart ValueListenable.value Value() T }
ValueListenable is an interface for subclasses of Listenable that expose a current value.
Flutter: foundation/change_notifier.dart ValueListenable
type ValueNotifier ¶
type ValueNotifier[T any] struct { ChangeNotifier // contains filtered or unexported fields }
ValueNotifier is a ChangeNotifier that holds a single value. When the value is replaced with something that is not equal to the old value, it notifies its listeners. Equality is Go's == for comparable values and identity for slices, maps and functions, as Dart's == is for lists and functions.
Flutter: foundation/change_notifier.dart ValueNotifier
func NewValueNotifier ¶
func NewValueNotifier[T any](value T) *ValueNotifier[T]
NewValueNotifier creates a ValueNotifier that starts with value.
Flutter: foundation/change_notifier.dart ValueNotifier.new
func (*ValueNotifier[T]) SetValue ¶
func (v *ValueNotifier[T]) SetValue(newValue T)
SetValue replaces the value. When it is not equal to the old one, the listeners are notified.
Flutter: foundation/change_notifier.dart ValueNotifier.value=
func (*ValueNotifier[T]) String ¶
func (v *ValueNotifier[T]) String() string
String describes the notifier, such as "ValueNotifier<int>#1a2b3(5)".
Flutter: foundation/change_notifier.dart ValueNotifier.toString
func (*ValueNotifier[T]) Value ¶
func (v *ValueNotifier[T]) Value() T
Value is the current value stored in the notifier.
Flutter: foundation/change_notifier.dart ValueNotifier.value
type VoidCallback ¶
type VoidCallback func()
VoidCallback is a function that takes no arguments and returns nothing.
Flutter: dart:ui VoidCallback