TranslationProvider class

A provider widget to initialize and manage translations throughout the app.

It wraps the entire widget tree and sets up:

  • Default and supported locales
  • Optional live translation updates
  • Translation delegate for fetching or customizing translations
  • Optional logging and connection settings
Inheritance

Constructors

TranslationProvider({Key? key, TranslationDelegate? delegate, Object? defaultLocale, bool connection = false, bool listening = false, bool notifiable = false, bool showLogs = false, Iterable supportedLocales = const [], Set<String>? paths, VoidCallback? onReady, required Widget child})
const

Properties

child Widget
The child widget tree that depends on translations.
final
connection bool
Whether to enable connection features (like fetching translations remotely).
final
defaultLocale Object?
The default locale to use if none is specified.
final
delegate TranslationDelegate?
Delegate responsible for providing translations.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
listening bool
Whether to listen for translation changes.
final
notifiable bool
Whether to notify the provider when translations change.
final
onReady VoidCallback?
Callback when the provider is ready and initialized.
final
paths Set<String>?
Optional paths to translation files or sources.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showLogs bool
Show debug logs.
final
supportedLocales Iterable
A list of supported locales in the app.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<TranslationProvider>
Creates the mutable state for this widget at a given location in the tree.
override
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