KeyboardLayoutProvider class

Manages keyboard languages and provides access to layouts.

This is the central registry for all available keyboard languages. Use KeyboardLayoutProvider.instance to access the singleton.

Example:

// Get the current language
final language = KeyboardLayoutProvider.instance.currentLanguage;

// Change language
KeyboardLayoutProvider.instance.setLanguage('bn');

// Get layouts for email input in current language
final layouts = KeyboardLayoutProvider.instance.getLayouts(KeyboardInputType.email);

Properties

currentLanguage → KeyboardLanguage
The currently selected language.
no setter
currentLanguageCode → String
The current language code.
no setter
hasExplicitLanguageSelection → bool
Whether the current language was explicitly selected during this app run.
no setter
hashCode → int
The hash code for this object.
no setterinherited
languageCodes → Iterable<String>
Available language codes.
no setter
languages → Iterable<KeyboardLanguage>
All registered languages.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Adds a listener that is called when the selected language changes.
getLanguage(String code) → KeyboardLanguage?
Gets a language by code, or null if not found.
getLayouts(KeyboardInputType inputType) → KeyboardLayoutSet
Gets the layout set for the given input type in the current language.
getLayoutsForLanguage(String languageCode, KeyboardInputType inputType) → KeyboardLayoutSet
Gets the layout set for the given input type in a specific language.
hasLanguage(String code) → bool
Checks if a language is registered.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerLanguage(KeyboardLanguage language) → void
Registers a new keyboard language.
removeListener(VoidCallback listener) → void
Removes a language selection listener.
reset() → void
Resets to default state (English only).
setLanguage(String code, {bool userInitiated = true}) → bool
Sets the current language by code.
toString() → String
A string representation of this object.
inherited
unregisterLanguage(String code) → bool
Unregisters a keyboard language by code.

Operators

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

Static Properties

instance → KeyboardLayoutProvider
The shared singleton registry used by every keyboard in the app.
final