vyuh_core
Compose features with FeatureDescriptor, choose shared capabilities with PluginDescriptor, and launch through runApp. This package owns platform lifecycle, base plugin contracts, navigation integration, dependency injection, events, analytics, and telemetry.
How the pieces fit together
Choose a declaration
AnalyticsPlugin · AnalyticsProvider · AppBuilder · AppRunner · AsyncLazyDI · AuthException · AuthPlugin · BuildFailureView · CreateUserFailure · DIPlugin · DefaultEnvPlugin · DefaultEventPlugin · DefaultNavigationPlugin · DeferredFeatureLoader · DeleteAccountFailure · DisposeFunction · EnvPlugin · ErrorViewBuilder · EventHandler · EventPlugin · ExtensionBuilder · ExtensionDescriptor · FailureActions · FailureCard · FailureKind · FailurePage · FeatureDescriptor · FeatureFlagPlugin · FeatureLoadFailedEvent · FeatureLoadedEvent · FeatureRedirect · FeaturesBuilder · GetItDIPlugin · HttpNetworkConfig · HttpNetworkPlugin · ImagePlaceholderBuilder · InitOncePlugin · InitState · LazyFeatureDescriptor · LazyFeaturesBuilder · Loader · LocaleConfiguration · LocalePlugin · LogLevel · Logger · LoggerInterface · LoginMethod · LoginMethodCanceled · LoginMethodFailure · LogoutFailure · NamedBindings · NamedPlugins · NavigationPlugin · NetworkPlugin · NoOpAnalyticsProvider · NoOpTelemetryProvider · NoOpTrace · OAuthType · PlatformLoggerInterface · PlatformWidgetBuilder · Plugin · PluginDescriptor · PreloadedPlugin · RedirectRegistry · Restartable · RouteBuilderFunction · RouteErrorViewBuilder · RouteFailureEvent · RouteFailureView · RouteLoader · RouteObservers · RouterUrlStyle · RoutingConfigNotifier · SecureStoragePlugin · SendEmailLinkFailure · SendPasswordResetEmailFailure · StoragePlugin · SystemEvent · SystemInitFailedEvent · SystemInitStartedEvent · SystemInitTracker · SystemReadyEvent · TelemetryPlugin · TelemetryProvider · Trace · TranslationRegistration · User · VoidFutureFunction · VyuhBinding · VyuhBranding · VyuhEvent · VyuhEventListener · VyuhFailure · VyuhFailureScope · VyuhPlatform · VyuhStrings · VyuhTheme · VyuhThemeExtension · debugAssertOneOfPathOrRouteId · defaultAppRunner · reportFailure · runApp · vyuh
AnalyticsPlugin
The default implementation of analytics tracking in Vyuh applications.
final class AnalyticsPlugin extends Plugin with PreloadedPlugin, InitOncePlugin, RouteObservers implements AnalyticsProviderDirectly declared public members:
final List<AnalyticsProvider> providers;The list of analytics providers managed by this plugin.
String get description;List<NavigatorObserver> get observers;Navigation observers for automatic route tracking.
AnalyticsPlugin({required this.providers});Creates a new AnalyticsPlugin with the given providers.
Future<void> initOnce();Initializes all analytics providers.
Future<void> disposeOnce();Disposes all analytics providers.
Future<void> reportEvent(String name, {Map<String, dynamic>? params});Reports an analytics event to all providers.
Future<void> identifyUser(String userId, {Map<String, dynamic>? traits});Identifies a user across all analytics providers.
Future<void> resetUser();Resets the user identity across all analytics providers.
AnalyticsProvider
The base interface for an Analytics Provider. The provider is responsible for reporting analytics events, errors, and messages.
abstract interface class AnalyticsProviderDirectly declared public members:
List<NavigatorObserver> get observers;The list of observers for the provider. These are added to the navigator, as part of the router setup.
String get name;The name of the provider.
String get title;The title of the provider.
String get description;The description of the provider.
Future<void> init();Initializes the provider.
Future<void> dispose();Disposes the provider.
Future<void> reportEvent(String name, {Map<String, dynamic>? params});Reports an event with a specific name and optional parameters.
Future<void> identifyUser(String userId, {Map<String, dynamic>? traits});Identifies a user with the given ID and optional traits. The traits can include any user properties like email, name, etc.
Future<void> resetUser();Clears the current user identification and associated traits. This should be called when the user logs out.
AppBuilder
A builder for root Widget of the application. Typically this would be a MaterialApp or CupertinoApp.
typedef AppBuilder = Widget Function(BuildContext context, VyuhPlatform platform);AppRunner
A function that takes a Widget and runs the application.
typedef AppRunner = void Function(Widget app);AsyncLazyDI
An extension on the DIPlugin class to provide asynchronous lazy dependency injection.
extension AsyncLazyDI on DIPluginDirectly declared public members:
void registerAsync<T extends Object>(Future<T> Function() fn, {String? name});Registers a lazily initialized asynchronous dependency in the dependency injection container.
Future<T> getAsync<T extends Object>({String? name});Retrieves an asynchronously initialized dependency from the dependency injection container.
AuthException
Base type for all Authentication related exceptions.
abstract class AuthException implements ExceptionDirectly declared public members:
const AuthException(this.error);Create an exception with the given error.
final Object error;The error that caused this exception.
String toString();AuthPlugin
An authentication plugin that supports various authentication methods.
abstract class AuthPlugin extends PluginDirectly declared public members:
var dynamic controller;The controller for the user changes stream.
String get token;String get refreshToken;AuthPlugin({required super.name, required super.title});Creates an instance of AuthPlugin.
User get currentUser;The current user that is signed in.
Stream<User> get userChanges;A stream of user changes.
void setCurrentUser(User user);Future<void> dispose();Future<void> init();Future<void> loginAnonymously();Future<void> sendOtp({required String phoneNumber});Future<void> loginWithPhoneOtp({required String phoneNumber, required String otp});Future<void> loginWithEmailPassword({required String email, required String password});Future<void> registerWithEmailPassword({required String email, required String password});Future<void> sendEmailLink({required String email, required String clientId});Future<void> sendPasswordResetEmail({required String email});Future<void> loginWithEmailLink({required String email, required String link});Future<void> loginWithOAuth(OAuthType type);Future<void> logout();Logs out the current user.
Future<bool> refreshSession();Attempts to refresh the current session token.
Future<void> deleteAccount();Deletes the current user account.
BuildFailureView
Shown in release builds in place of a widget that failed to build. Small, quiet and themed, so one broken widget does not break the page.
class BuildFailureView extends StatelessWidgetDirectly declared public members:
final FlutterErrorDetails details;const BuildFailureView({super.key, required this.details});Widget build(BuildContext context);CreateUserFailure
Exception thrown when creating a user fails.
final class CreateUserFailure extends AuthExceptionDirectly declared public members:
const CreateUserFailure(super.error);DIPlugin
DIPlugin is an abstract class that extends the Plugin class.
abstract class DIPlugin extends PluginDirectly declared public members:
DIPlugin({required super.name, required super.title});Constructs a DIPlugin instance with the given name and title.
void register<T extends Object>(T instance, {String? name});Registers an instance of any Object type with the DI container.
void registerLazy<T extends Object>(T Function() fn, {String? name});Registers a function that produces an instance of any Object type.
void registerFactory<T extends Object>(T Function() fn, {String? name});Registers a factory function that produces a new instance each time it is called.
void unregister<T extends Object>({String? name});Removes the instance of the specified type from the DI container.
T get<T extends Object>({String? name});Retrieves the registered instance of type T from the DI container.
bool has<T extends Object>({String? name});Checks if an instance of the specified type is registered in the DI container.
Future<void> reset();Clears all instances registered in the DI container.
DefaultEnvPlugin
Public declaration in this package.
final class DefaultEnvPlugin extends EnvPluginDirectly declared public members:
final String fileName;final Map<String, String> defaults;DefaultEnvPlugin({this.fileName = '.env', this.defaults = const {}});Future<void> init();Map<String, String> all();dynamic clear();Future<void> dispose();String get(String key, {String? fallback});String? maybeGet(String key, {String? fallback});DefaultEventPlugin
Default implementation of EventPlugin using the event_bus package.
final class DefaultEventPlugin extends EventPluginDirectly declared public members:
DefaultEventPlugin();void emit<T extends VyuhEvent>(T event);DisposeFunction on<T extends VyuhEvent>(VyuhEventListener<T> listener);void once<T extends VyuhEvent>(VyuhEventListener<T> listener);Future<void> dispose();Future<void> init();DefaultNavigationPlugin
Public declaration in this package.
final class DefaultNavigationPlugin extends NavigationPluginDirectly declared public members:
final g.GoRouterRedirect? redirect;The global redirect for this router, run before every feature redirect.
DefaultNavigationPlugin({final bool urlReflectsImperativeAPIs = false, this.redirect, RouterUrlStyle? urlStyle});Creates the GoRouter-based navigation plugin.
GoRouter get instance;static void enableURLReflectsImperativeAPIs();static void usePathStrategy();static void useHashStrategy();static void setRouterRedirect(g.GoRouterRedirect redirect);void initRouter({String? initialLocation, required List<g.RouteBase> routes, required GlobalKey<NavigatorState> rootNavigatorKey});dynamic replaceRoutes(List<g.RouteBase> routes);void appendInitialRoutes(List<g.RouteBase> routes);dynamic appendRoutes(List<g.RouteBase> routes);Future<void> init();Future<void> dispose();void go(String location, {Object? extra});void goNamed(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, dynamic> queryParameters = const <String, dynamic>{}, Object? extra});void pop<T extends Object?>([T? result]);Future<T?> push<T extends Object?>(String location, {Object? extra});Future<T?> pushNamed<T extends Object?>(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, dynamic> queryParameters = const <String, dynamic>{}, Object? extra});Future<T?> pushReplacement<T extends Object?>(String location, {Object? extra});Future<T?> pushReplacementNamed<T extends Object?>(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, dynamic> queryParameters = const <String, dynamic>{}, Object? extra});Future<T?> replace<T extends Object?>(String location, {Object? extra});Future<T?> replaceNamed<T extends Object?>(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, dynamic> queryParameters = const <String, dynamic>{}, Object? extra});DeferredFeatureLoader
A callback that loads a FeatureDescriptor, potentially using Dart's deferred import mechanism for web code splitting.
typedef DeferredFeatureLoader = Future<FeatureDescriptor> Function();DeleteAccountFailure
Exception thrown when the account deletion fails.
final class DeleteAccountFailure extends AuthExceptionDirectly declared public members:
const DeleteAccountFailure(super.error);Create a new DeleteAccountFailure with the given error.
DisposeFunction
A function that can be called to dispose of (cancel) an event subscription.
typedef DisposeFunction = void Function();EnvPlugin
An abstract class representing an environment plugin. It provides methods to interact with environment variables.
abstract class EnvPlugin extends PluginDirectly declared public members:
EnvPlugin({required super.name, required super.title});Constructs an EnvPlugin with the given name and title.
Map<String, String?> all();Returns a map of all environment variables.
String get(String key, {String? fallback});Returns the value of the environment variable specified by key, or the fallback value if not found.
String? maybeGet(String key, {String? fallback});Returns the value of the environment variable specified by key, or the fallback value if not found, or null if neither is found.
void clear();Clears all the environment variables.
ErrorViewBuilder
A builder for an error view widget.
typedef ErrorViewBuilder = Widget Function( BuildContext context,EventHandler
A typed event listener that a feature declares in FeatureDescriptor.events.
final class EventHandler<T extends VyuhEvent>Directly declared public members:
final VyuhEventListener<T> listener;Called for every event of type T.
const EventHandler(this.listener);Creates a handler for events of type T.
Type get eventType;The event type this handler listens to.
DisposeFunction subscribe(EventPlugin events);Subscribes listener on events, keeping the generic type T. Used by the platform; features do not call this.
EventPlugin
Base class for implementing event handling in Vyuh applications.
abstract class EventPlugin extends Plugin with PreloadedPluginDirectly declared public members:
EventPlugin({required super.name, required super.title});DisposeFunction on<T extends VyuhEvent>(VyuhEventListener<T> listener);Subscribe to events of type T.
void once<T extends VyuhEvent>(VyuhEventListener<T> listener);Subscribe to a single occurrence of an event of type T.
void emit<T extends VyuhEvent>(T event);Emit an event to all subscribers.
ExtensionBuilder
The base type for all extension builders. An extension builder is responsible for building an extension, by assembling all of the extension descriptors.
abstract class ExtensionBuilder<T extends ExtensionDescriptor>Directly declared public members:
final String title;The title of the extension.
final Type extensionType;The runtime Type of the extension.
String? get sourceFeature;The name of the feature which this extension belongs to. This is set by the bootstrapping process of Vyuh.
void setSourceFeature(String featureName);Sets the source feature for this extension builder. This is called by the Vyuh bootstrapping process.
ExtensionBuilder({required this.extensionType, required this.title});Creates a new ExtensionBuilder.
bool get isInitialized;Whether the extension is currently initialized.
bool get isDisposed;Whether the extension has been disposed.
Future<void> onInit(List<T> extensions);Protected method for subclasses to implement initialization logic.
Future<void> onDispose();Protected method for subclasses to implement disposal logic.
void registerLazy(ExtensionDescriptor descriptor);Registers extensions from a lazily-loaded feature. Override in subclasses that support incremental registration. By default this is a no-op.
VoidCallback captureLazyState(ExtensionDescriptor descriptor);Captures state before lazy registration and returns a synchronous rollback. Builders supporting registerLazy must include all mutated registries. Unsupported builders fail before any contribution is published.
Future<void> init(List<ExtensionDescriptor> extensions);Initializes the extension.
Future<void> dispose();Disposes the extension.
ExtensionDescriptor
The base type for all extension descriptors. An ExtensionDescriptor provides configurability for an extension.
abstract class ExtensionDescriptorDirectly declared public members:
final String title;The title of the extension.
String? get sourceFeature;The name of the feature which this extension belongs to. This is set by the Vyuh bootstrapping process
void setSourceFeature(String featureName);Sets the source feature for this extension. This is called by the Vyuh bootstrapping process.
ExtensionDescriptor({required this.title});Creates a new ExtensionDescriptor.
void onSourceFeatureUpdated();FailureActions
The recovery actions that apply in a given context. Every error view offers the same choices in the same order: Retry, Go home, Back, Restart.
abstract final class FailureActionsDirectly declared public members:
static bool canGoBack(BuildContext context);Whether there is a page to go back to.
static bool canGoHome(BuildContext context, [VyuhFailure? failure]);Whether "Go home" can help: the router exists, the failure allows it, and the failure is not on the home route itself.
static bool needsRestart(BuildContext context, [VyuhFailure? failure]);Whether only a restart can help: there is no router yet, or the platform failed to initialize.
static void goBack(BuildContext context);Goes back one page.
static void goHome();Goes to the home route.
static void restart();Restarts the platform. This rebuilds the whole app, so it is the last resort.
FailureCard
The default inline failure, used inside a page for a part that failed.
class FailureCard extends StatelessWidgetDirectly declared public members:
final String title;final String? message;final Object? error;final StackTrace? stackTrace;final VoidCallback? onRetry;final String? retryLabel;final bool showRestart;const FailureCard({super.key, required this.title, this.message, this.error, this.stackTrace, this.onRetry, this.retryLabel, this.showRestart = false});Widget build(BuildContext context);FailureKind
What went wrong, used to pick the message and the recovery actions.
enum FailureKind { init, notFound, route, featureLoad, featureDisabled, content, unexpected }FailurePage
The default full-page failure: a themed page with a clear message and the recovery actions that apply. Error details appear only in debug builds.
class FailurePage extends StatelessWidgetDirectly declared public members:
final String title;final String? message;final Object? error;final StackTrace? stackTrace;final VoidCallback? onRetry;final String? retryLabel;final bool showRestart;Shows Restart even when other actions are available.
const FailurePage({super.key, required this.title, this.message, this.error, this.stackTrace, this.onRetry, this.retryLabel, this.showRestart = false});Widget build(BuildContext context);FeatureDescriptor
The essential descriptor for a feature. A feature descriptor provides the necessary information to register a feature within the framework.
final class FeatureDescriptorDirectly declared public members:
final String name;The name of the feature.
final String title;The title of the feature.
final String? description;The description of the feature.
final IconData? icon;The icon of the feature.
final VoidFutureFunction? init;The function to initialize the feature.
final VoidFutureFunction? dispose;The function to dispose the feature.
final List<ExtensionDescriptor>? extensions;The list of extensions for the feature.
final List<ExtensionBuilder>? extensionBuilders;The list of extension builders exposed by this feature.
final List<String> dependencies;Optional list of feature names that must be initialized before this feature. Used for ordering during initialization. If empty (the default), no ordering constraint is applied.
final List<EventHandler> events;App-level event listeners. The platform subscribes them before the feature's init runs and cancels them on dispose, restart, or a failed lazy activation. See EventHandler and SystemEvent.
final List<FeatureRedirect> redirects;Redirects this feature adds to the app's router, evaluated in feature order after the global redirect. See FeatureRedirect.
RouteBuilderFunction? get routes;The routes for the feature, or null when it contributes none. Features that only add event handlers, redirects, extensions or services can leave this out.
FeatureDescriptor({required this.name, required this.title, this.description, this.icon, this.init, this.dispose, RouteBuilderFunction? routes, this.extensions, this.extensionBuilders, this.dependencies = const [], this.events = const [], this.redirects = const []});Creates a new FeatureDescriptor.
FeatureFlagPlugin
The base class for a Feature Flag plugin. Feature Flags are useful to control the visibility of features in an application. They are setup on the server side and can be controlled by the server to enable/disable features for different users.
abstract class FeatureFlagPlugin<TSettings, TContext> extends PluginDirectly declared public members:
final TSettings settings;The settings for the feature flag plugin.
FeatureFlagPlugin({required this.settings, required super.name, required super.title});Future<bool> getBool(String featureName, {bool defaultValue = false});Returns the value of the feature flag as a boolean.
Future<String> getString(String featureName, {String defaultValue = ''});Returns the value of the feature flag as a string.
Future<int> getInt(String featureName, {int defaultValue = 0});Returns the value of the feature flag as an integer.
Future<double> getDouble(String featureName, {double defaultValue = 0.0});Returns the value of the feature flag as a double.
Future<Map<String, dynamic>> getJson(String featureName, {Map<String, dynamic> defaultValue = const {}});Returns the value of the feature flag as a JSON object represented by a Map.
Future<void> setDefaults(Map<String, dynamic> defaults);Sets the default values for the feature flags. This is useful when the plugin is first initialized and want to set defaults before fetching the actual values.
Future<void> updateContext(TContext context);Updates the context of the feature flag plugin. This could include setting the user id, user attributes, locale, etc.
Future<void> refresh();Refreshes the feature flags. This is useful to force an update on the feature flag values.
FeatureLoadFailedEvent
Emitted when a lazy feature fails to load, or is disabled by its flag.
final class FeatureLoadFailedEvent extends SystemEvent<VyuhFailure>Directly declared public members:
final String featureName;The name of the feature.
final VyuhFailure failure;The failure. Its kind is FailureKind.featureDisabled for a disabled feature and FailureKind.featureLoad otherwise.
FeatureLoadFailedEvent({required this.featureName, required this.failure});FeatureLoadedEvent
Emitted after a feature is ready: an eager feature finished its init, or a lazy feature finished loading and activating.
final class FeatureLoadedEvent extends SystemEvent<String>Directly declared public members:
final String featureName;The name of the feature.
final bool isLazy;Whether the feature was loaded lazily.
FeatureLoadedEvent({required this.featureName, required this.isLazy});FeatureRedirect
A redirect that a feature contributes to the app's router.
final class FeatureRedirectDirectly declared public members:
final String name;A short name used in logs and error reports.
final GoRouterRedirect redirect;Returns a new location to redirect to, or null to continue.
final List<Type> refreshOn;Event types that make the router re-run its redirects. Matching is by exact runtime type.
final Listenable? listenable;An optional listenable (a ValueNotifier, a ChangeNotifier, or a MobX store bridged to a listenable) that makes the router re-run its redirects when it notifies.
const FeatureRedirect({required this.name, required this.redirect, this.refreshOn = const [], this.listenable});Creates a feature redirect.
FeaturesBuilder
The builder function that creates a set of features.
typedef FeaturesBuilder = FutureOr<List<FeatureDescriptor>> Function();GetItDIPlugin
GetItDIPlugin is a class that is final and it extends the DIPlugin. It uses the 'GetIt' package to manage dependency injection in the project.
final class GetItDIPlugin extends DIPluginDirectly declared public members:
final String? debugLabel;GetItDIPlugin({this.debugLabel});Future<void> init();Future<void> dispose();T get<T extends Object>({String? name});bool has<T extends Object>({String? name});void register<T extends Object>(T instance, {String? name});void registerFactory<T extends Object>(T Function() fn, {String? name});void registerLazy<T extends Object>(T Function() fn, {String? name});Future<void> reset();void unregister<T extends Object>({String? name});HttpNetworkConfig
Public declaration in this package.
final class HttpNetworkConfigDirectly declared public members:
final Duration timeout;final int maxRetryAttempts;final Duration maxRetryDelay;const HttpNetworkConfig({required this.timeout, required this.maxRetryAttempts, required this.maxRetryDelay});static const dynamic standard;HttpNetworkPlugin
Public declaration in this package.
final class HttpNetworkPlugin extends NetworkPluginDirectly declared public members:
HttpNetworkPlugin({Client? client, RetryOptions? retryOptions, Duration? timeout, this._webIncludeCredentials = true});Creates an HTTP network plugin.
Future<void> init();Future<void> dispose();Future<Response> get(Uri url, {Map<String, String>? headers});Future<Response> head(Uri url, {Map<String, String>? headers});Future<Response> post(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding});Future<Response> put(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding});Future<Response> delete(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding});Future<Response> patch(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding});void close();Future<String> read(Uri url, {Map<String, String>? headers});Future<Uint8List> readBytes(Uri url, {Map<String, String>? headers});Future<StreamedResponse> send(BaseRequest request);ImagePlaceholderBuilder
A builder for an image placeholder widget.
typedef ImagePlaceholderBuilder = Widget Function(BuildContext context,InitOncePlugin
Initializes a plugin once per active lifecycle, sharing concurrent calls.
mixin InitOncePlugin on PluginDirectly declared public members:
bool get initialized;Future<void> init();Future<void> dispose();Future<void> initOnce();Future<void> disposeOnce();InitState
The possible states of the system initialization.
enum InitState { notStarted, plugins, features, ready, error }LazyFeatureDescriptor
Describes a feature that should be loaded lazily — only when one of its route prefixes is first navigated to.
final class LazyFeatureDescriptorDirectly declared public members:
final String name;Unique name for this feature. Must match the inner FeatureDescriptor.name returned by loader.
final String title;Human-readable title shown in the loading UI while the feature is being downloaded and initialized.
final String? description;Optional description of what this feature does.
final IconData? icon;Optional icon for the loading indicator.
final List<String> routePrefixes;Route path prefixes that belong to this feature. When any URL matching these prefixes is navigated to, the feature is loaded.
final DeferredFeatureLoader loader;The function that loads the actual FeatureDescriptor. This is where deferred as loading happens.
final List<String> dependencies;Optional list of feature names this feature depends on. If a dependency is also lazy, it will be loaded first. If a dependency is already loaded (eager or previously loaded lazy), it is skipped.
final String? featureFlag;Optional feature flag name. If provided and a FeatureFlagPlugin is registered, the feature is only loaded when the flag evaluates to true.
LazyFeatureDescriptor({required this.name, required this.title, required this.routePrefixes, required this.loader, this.description, this.icon, this.dependencies = const [], this.featureFlag});LazyFeaturesBuilder
A builder that returns lazy feature descriptors.
typedef LazyFeaturesBuilder = List<LazyFeatureDescriptor> Function();Loader
A builder for a widget that is shown when the app is loading.
typedef Loader = Widget Function(BuildContext context);LocaleConfiguration
Configuration for a single locale including its code, native name, and icon
class LocaleConfigurationDirectly declared public members:
final Locale locale;The Flutter locale
final String nativeName;Native name of the language (e.g., "हिन्दी" for Hindi)
final String icon;Icon/emoji representing the locale (e.g., "🇮🇳" for Hindi)
const LocaleConfiguration({required this.locale, required this.nativeName, required this.icon});String get languageCode;Get the language code from the locale
factory LocaleConfiguration.fromCode(String code, {required String nativeName, required String icon});Create from language code with explicit name and icon
LocalePlugin
Plugin for managing internationalization across features
class LocalePlugin extends PluginDirectly declared public members:
final List<LocaleConfiguration> locales;List of supported locale configurations
final Observable<Locale> currentLocale;Raw observable for the current locale (no codegen)
final Observable<bool> isLoadingLocale;Raw observable to track locale loading state (no codegen)
LocaleConfiguration get defaultLocale;Get the default locale configuration
List<Locale> get supportedLocales;Available locales in the application
LocalePlugin({required this.locales, this._defaultLocale});void registerTranslations(TranslationRegistration registration);Register a feature's translation configuration
Future<bool> setLocale(Locale locale);Set the application locale
Future<void> useDeviceLocale();Use the device's locale if supported, otherwise default to configured default
bool isLocaleActive(Locale locale);Check if a specific locale is currently active
String getLocaleName(String localeCode);Get the native name for a locale code
String getLocaleIcon(String localeCode);Get the icon/emoji for a locale code
String get currentLocaleCode;Get the current locale code
int get registrationCount;Number of registered translations
Future<void> init();Future<void> dispose();LogLevel
Public declaration in this package.
enum LogLevel { debug, info, trace, warning, error, fatal }Logger
Public declaration in this package.
abstract interface class LoggerDirectly declared public members:
void trace(dynamic message);void debug(dynamic message);void info(dynamic message);void warn(dynamic message);void error(dynamic message, {Object? error});void fatal(dynamic message, {Object? error, StackTrace? stackTrace});LoggerInterface
A convenience wrapper to provide a Logger interface to the Telemetry reportMessage() calls.
extension LoggerInterface on VyuhBindingDirectly declared public members:
Logger get log;LoginMethod
Represents the method used to login.
enum LoginMethod { unknown, anonymous, emailPassword, phoneOtp, emailLink, google, facebook, apple, twitter, github, linkedin, microsoft, custom }Directly declared public members:
IconData icon();Returns the icon for this login method. This is useful only in the developer tools or UI.
String label();Returns the label for this login method. This is useful only in the developer tools or UI.
LoginMethodCanceled
Exception thrown when a login method is canceled.
final class LoginMethodCanceled extends AuthExceptionDirectly declared public members:
final LoginMethod method;The login method that was canceled.
const LoginMethodCanceled(this.method, super.error);Create a new LoginMethodCanceled with the given method and error.
LoginMethodFailure
Exception thrown when a login method fails.
final class LoginMethodFailure extends AuthExceptionDirectly declared public members:
final LoginMethod method;The login method that failed.
const LoginMethodFailure(this.method, super.error);Create a new LoginMethodFailure with the given method and error.
LogoutFailure
Exception thrown when the logout fails.
final class LogoutFailure extends AuthExceptionDirectly declared public members:
const LogoutFailure(super.error);Create a new LogoutFailure with the given error.
NamedBindings
The same named accessors as vyuh.*, for code that must also run in widget mode, where runApp (and so vyuh) is not used.
extension NamedBindings on VyuhBindingDirectly declared public members:
DIPlugin get di;The dependency injection plugin, providing dependency injection services.
AnalyticsPlugin get analytics;The analytics plugin, for tracking and reporting analytics data.
TelemetryPlugin get telemetry;The telemetry plugin, used for monitoring and logging telemetry information.
NetworkPlugin get network;The network plugin, for handling network requests and communication.
FeatureFlagPlugin? get featureFlag;The feature flag plugin, used for managing and toggling feature flags. Can be null if the plugin is not registered.
EnvPlugin get env;The environment plugin, providing access to platform-specific environment settings.
EventPlugin get event;The event plugin, for managing and emitting events within the platform.
AuthPlugin get auth;The authentication plugin.
NavigationPlugin get router;The navigation plugin.
LocalePlugin? get locale;The locale plugin, or null when it is not registered.
StoragePlugin get storage;The storage plugin, for general key-value persistence.
SecureStoragePlugin get secureStorage;The secure storage plugin, for secrets such as tokens.
NamedPlugins
Named accessors for the system plugins: vyuh.router, vyuh.auth, ...
extension NamedPlugins on VyuhPlatformDirectly declared public members:
DIPlugin get di;The dependency injection plugin, providing dependency injection services.
AnalyticsPlugin get analytics;The analytics plugin, for tracking and reporting analytics data.
TelemetryPlugin get telemetry;The telemetry plugin, used for monitoring and logging telemetry information.
NetworkPlugin get network;The network plugin, for handling network requests and communication.
AuthPlugin get auth;The authentication plugin, responsible for user authentication and authorization.
NavigationPlugin get router;The navigation/router plugin, managing navigation within the application.
FeatureFlagPlugin? get featureFlag;The feature flag plugin, used for managing and toggling feature flags. Can be null if the plugin is not registered.
EnvPlugin get env;The environment plugin, providing access to platform-specific environment settings.
EventPlugin get event;The event plugin, for managing and emitting events within the platform.
LocalePlugin? get locale;The locale plugin, providing access to locale settings. Can be null if the plugin is not registered.
StoragePlugin get storage;The storage plugin, for general key-value persistence.
SecureStoragePlugin get secureStorage;The secure storage plugin, for secrets such as tokens.
NavigationPlugin
Public declaration in this package.
abstract class NavigationPlugin extends PluginDirectly declared public members:
GoRouter get instance;static const dynamic catchAllPath;The path of a catch-all route. A feature can contribute one GoRoute with this path to handle every location no other route matches; the router always places it last. Without one, unmatched locations show the not-found RouteFailureView.
NavigationPlugin({required super.name, required super.title});final RedirectRegistry featureRedirects;Redirects contributed by features through FeatureDescriptor.redirects.
VoidCallback watchRedirectTriggers(VoidCallback refresh);Calls refresh whenever a feature redirect's trigger fires: one of its refreshOn events is emitted, or its listenable notifies. Also calls refresh when the set of redirects changes. Returns a function that stops watching.
String homeLocation;The location of the home route, used by error views to offer a way back. Set by the platform from runApp(homeLocation: ...).
void goHome();Navigates to homeLocation.
void initRouter({String? initialLocation, required List<g.RouteBase> routes, required GlobalKey<NavigatorState> rootNavigatorKey});void replaceRoutes(List<g.RouteBase> routes);void appendRoutes(List<g.RouteBase> routes);void appendInitialRoutes(List<g.RouteBase> routes);void pop<T extends Object?>([T? result]);void go(String location, {Object? extra});void goNamed(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, dynamic> queryParameters = const <String, dynamic>{}, Object? extra});Future<T?> push<T extends Object?>(String location, {Object? extra});Future<T?> pushNamed<T extends Object?>(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, dynamic> queryParameters = const <String, dynamic>{}, Object? extra});Future<T?> pushReplacement<T extends Object?>(String location, {Object? extra});Future<T?> pushReplacementNamed<T extends Object?>(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, dynamic> queryParameters = const <String, dynamic>{}, Object? extra});Future<T?> replace<T extends Object?>(String location, {Object? extra});Future<T?> replaceNamed<T extends Object?>(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, dynamic> queryParameters = const <String, dynamic>{}, Object? extra});NetworkPlugin
Base class for implementing network communication in Vyuh applications.
abstract class NetworkPlugin extends Plugin with PreloadedPlugin implements ClientDirectly declared public members:
NetworkPlugin({required super.name, required super.title});Future<Response> get(Uri url, {Map<String, String>? headers});Sends an HTTP GET request to the given URL.
Future<Response> head(Uri url, {Map<String, String>? headers});Sends an HTTP HEAD request to the given URL.
Future<Response> post(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding});Sends an HTTP POST request to the given URL.
Future<Response> put(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding});Sends an HTTP PUT request to the given URL.
Future<Response> delete(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding});Sends an HTTP DELETE request to the given URL.
Future<Response> patch(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding});Sends an HTTP PATCH request to the given URL.
NoOpAnalyticsProvider
A no-op implementation of AnalyticsProvider.
final class NoOpAnalyticsProvider implements AnalyticsProviderDirectly declared public members:
String get name;String get title;String get description;Future<void> dispose();Future<void> init();Future<void> reportEvent(String name, {Map<String, dynamic>? params});Future<void> identifyUser(String userId, {Map<String, dynamic>? traits});Future<void> resetUser();List<NavigatorObserver> get observers;NoOpTelemetryProvider
A no-op implementation of TelemetryProvider that can be used for development or testing purposes.
final class NoOpTelemetryProvider implements TelemetryProviderDirectly declared public members:
Future<Trace> startTrace(String name, String operation, {LogLevel? level = LogLevel.info});String get name;String get title;String get description;Future<void> dispose();Future<void> init();Future<void> reportError(exception, {StackTrace? stackTrace, Map<String, dynamic>? params, bool fatal = false});Future<void> reportFlutterError(FlutterErrorDetails details, {bool fatal = false});Future<void> reportMessage(String message, {Map<String, dynamic>? params, LogLevel? level = LogLevel.info});NoOpTrace
A no-op implementation of Trace that can be used for development or testing.
final class NoOpTrace extends TraceDirectly declared public members:
Map<String, String> getAttributes();int getMetric(String name);void setAttributes(Map<String, String> attributes);void setMetric(String name, int value);Future<void> stop();Future<Trace> startChild(String name, String operation, {LogLevel? level = LogLevel.info});OAuthType
Public declaration in this package.
enum OAuthType { google, apple, meta, github, twitter, linkedin, microsoft, custom }Directly declared public members:
LoginMethod get loginMethod;PlatformLoggerInterface
Public declaration in this package.
extension PlatformLoggerInterface on VyuhPlatformDirectly declared public members:
Logger get log;PlatformWidgetBuilder
A builder for platform-specific widgets used throughout the Vyuh application.
class PlatformWidgetBuilderDirectly declared public members:
final AppBuilder appBuilder;A builder for the app widget. This becomes the root of the widget tree. Typically this would return a MaterialApp or CupertinoApp.
final Loader appLoader;A loader widget that is shown when the app is loading.
final Loader contentLoader;An inline loader, shown while a part of a page (a section, a list, an image) loads. Unlike routeLoader it does not take over the page.
final RouteLoader routeLoader;A loader widget that is shown when a route is loading.
final ImagePlaceholderBuilder imagePlaceholder;A builder for the image placeholder widget.
final RouteErrorViewBuilder routeErrorView;A builder for the route error view widget.
final ErrorViewBuilder errorView;A builder for the error view widget.
final VyuhTheme theme;The app's themes. Used by the default appBuilder, and by the loading and failure screens shown before the app itself is built, so the very first frame already matches the app. See VyuhTheme.
final VyuhStrings strings;Every user-facing string the framework shows. See VyuhStrings.
PlatformWidgetBuilder({required this.appBuilder, required this.appLoader, required this.contentLoader, required this.routeLoader, required this.errorView, required this.routeErrorView, required this.imagePlaceholder, VyuhTheme? theme, this.strings = const VyuhStrings()});Creates a new PlatformWidgetBuilder instance.
PlatformWidgetBuilder copyWith({AppBuilder? appBuilder, Loader? appLoader, Loader? contentLoader, RouteLoader? routeLoader, ImagePlaceholderBuilder? imagePlaceholder, RouteErrorViewBuilder? routeErrorView, ErrorViewBuilder? errorView, VyuhTheme? theme, VyuhStrings? strings});Creates a copy of this PlatformWidgetBuilder but with the given fields
static final dynamic system;The framework defaults: a Material app root using theme, themed loaders, and error views that always offer a way back.
Plugin
Public declaration in this package.
abstract class PluginDirectly declared public members:
final String name;final String title;Plugin({required this.name, required this.title});Future<void> init();Future<void> dispose();PluginDescriptor
A descriptor for configuring the plugin system in a Vyuh application.
final class PluginDescriptorDirectly declared public members:
List<Plugin> get plugins;PluginDescriptor({final DIPlugin? di, final AnalyticsPlugin? analytics, final TelemetryPlugin? telemetry, final NetworkPlugin? network, final AuthPlugin? auth, final NavigationPlugin? navigation, final EnvPlugin? env, final EventPlugin? event, final StoragePlugin? storage, final SecureStoragePlugin? secureStorage, final List<Plugin>? others});static final dynamic systemPluginTypes;static final dynamic system;T? get<T extends Plugin>();PreloadedPlugin
A mixin to mark any plugin to be loaded before the Platform.
mixin PreloadedPlugin on PluginRedirectRegistry
The redirects and refresh triggers currently contributed by features.
final class RedirectRegistryDirectly declared public members:
List<FeatureRedirect> get redirects;The redirects in evaluation order.
void add(String feature, List<FeatureRedirect> redirects);Adds the redirects of feature at the end of the chain.
void remove(String feature);Removes every redirect contributed by feature.
void clear();Removes all redirects.
bool refreshesOn(Type type);Whether any redirect asks to refresh on events of type.
List<Listenable> get listenables;All listenables that should refresh the router.
void addListener(VoidCallback listener);Notified whenever the set of redirects changes.
void removeListener(VoidCallback listener);Removes a listener added with addListener.
Future<String?> evaluate(BuildContext context, GoRouterState state, {GoRouterRedirect? base});Runs base then each feature redirect, returning the first location.
Restartable
Restart the platform, re-running the initialization process.
extension Restartable on VyuhPlatformDirectly declared public members:
Future<void> restart();RouteBuilderFunction
A function that returns a list of routes.
typedef RouteBuilderFunction = FutureOr<List<g.RouteBase>?> Function();RouteErrorViewBuilder
A builder for a route error view widget.
typedef RouteErrorViewBuilder = Widget Function( BuildContext context,RouteFailureEvent
Emitted once each time a route cannot be shown: no match, a page that failed to load or a failed lazy feature.
final class RouteFailureEvent extends SystemEvent<VyuhFailure>Directly declared public members:
final VyuhFailure failure;The failure, including the location that failed.
RouteFailureEvent(this.failure);RouteFailureView
Shows a route-level failure through PlatformWidgetBuilder.routeErrorView and reports it once, to telemetry and as a RouteFailureEvent.
class RouteFailureView extends StatefulWidgetDirectly declared public members:
final VyuhFailure failure;The failure to show.
final VoidCallback? onRetry;Re-runs only the failed operation. Hidden when null.
final String? retryLabel;The label of the retry button.
const RouteFailureView({super.key, required this.failure, this.onRetry, this.retryLabel});State<RouteFailureView> createState();RouteLoader
A builder for a widget that is shown when a route is loading.
typedef RouteLoader = Widget Function(BuildContext context, [Uri? url, String? routeId]);RouteObservers
Public declaration in this package.
mixin RouteObservers on PluginDirectly declared public members:
List<NavigatorObserver> get observers;RouterUrlStyle
How URLs look on the web. Has no effect on other platforms.
enum RouterUrlStyle { hash, path }RoutingConfigNotifier
Public declaration in this package.
final class RoutingConfigNotifier extends ValueNotifier<g.RoutingConfig>Directly declared public members:
final g.GoRouterRedirect? redirect;RoutingConfigNotifier(List<g.RouteBase> routes, {this.redirect});void setRoutes(List<g.RouteBase> routes);SecureStoragePlugin
A storage contract for app-selected secure storage implementations.
abstract class SecureStoragePlugin extends PluginDirectly declared public members:
SecureStoragePlugin({required super.name, required super.title});Future<dynamic> read(String key);Reads a value from secure storage by its key.
Future<dynamic> write(String key, dynamic value);Writes a value to secure storage with the given key.
Future<bool> has(String key);Checks if a key exists in secure storage.
Future<bool> delete(String key);Deletes a value from secure storage by its key.
SendEmailLinkFailure
Exception thrown when sending an email-link for logging in.
final class SendEmailLinkFailure extends AuthExceptionDirectly declared public members:
const SendEmailLinkFailure(super.error);Create a new SendEmailLinkFailure with the given error.
SendPasswordResetEmailFailure
Exception thrown when sending a password reset email.
final class SendPasswordResetEmailFailure extends AuthExceptionDirectly declared public members:
const SendPasswordResetEmailFailure(super.error);Create a new SendPasswordResetEmailFailure with the given error.
StoragePlugin
A key-value storage capability shared by features.
abstract class StoragePlugin extends PluginDirectly declared public members:
StoragePlugin({required super.name, required super.title});Future<dynamic> read(String key);Reads a value from storage by its key.
Future<dynamic> write(String key, dynamic value);Writes a value to storage with the given key.
Future<bool> has(String key);Checks if a key exists in storage.
Future<bool> delete(String key);Deletes a value from storage by its key.
SystemEvent
The base type for every event the platform emits about its own lifecycle.
abstract class SystemEvent<T> extends VyuhEvent<T>Directly declared public members:
SystemEvent({required super.name, super.data});SystemInitFailedEvent
Emitted when platform initialization fails.
final class SystemInitFailedEvent extends SystemEvent<VyuhFailure>Directly declared public members:
final VyuhFailure failure;The failure that stopped initialization.
SystemInitFailedEvent(this.failure);SystemInitStartedEvent
Emitted when platform initialization starts, including on restart.
final class SystemInitStartedEvent extends SystemEvent<void>Directly declared public members:
final bool isRestart;Whether this init is a restart of an already-initialized platform.
SystemInitStartedEvent({required this.isRestart});SystemInitTracker
A tracker for the system initialization process.
abstract interface class SystemInitTrackerDirectly declared public members:
VyuhPlatform get platform;The platform that is being initialized.
Observable<InitState> get currentState;The current state of the initialization process.
FutureStatus? get status;The status of the future that is being awaited.
dynamic get error;The error that occurred during initialization.
Future<void> init([InitState initialState]);Initializes the system.
SystemReadyEvent
An event indicating that the system is ready.
final class SystemReadyEvent extends SystemEvent<void>Directly declared public members:
SystemReadyEvent();Creates a new SystemReadyEvent.
TelemetryPlugin
The default implementation for a Telemetry Plugin.
final class TelemetryPlugin extends Plugin with PreloadedPlugin, InitOncePlugin implements TelemetryProviderDirectly declared public members:
final List<TelemetryProvider> providers;The list of providers for the plugin.
String get description;TelemetryPlugin({required this.providers});Creates a new TelemetryPlugin.
Future<void> initOnce();Future<void> disposeOnce();Future<Trace> startTrace(String name, String operation, {LogLevel? level = LogLevel.info});Future<void> reportError(exception, {StackTrace? stackTrace, Map<String, dynamic>? params, bool fatal = false});Future<void> reportFlutterError(FlutterErrorDetails details, {bool fatal = false});Future<void> reportMessage(String message, {Map<String, dynamic>? params, LogLevel? level = LogLevel.info});Future<T?> trace<T>({required String name, required String operation, required FutureOr<T?> Function(Trace? parentTrace) fn, Trace? parentTrace, LogLevel? level = LogLevel.info});Runs a function with a trace. This is useful for wrapping functions that need to be traced. It can also be part of a nested trace, using the parentTrace parameter.
TelemetryProvider
The base interface for an Telemetry Provider. The provider is responsible for reporting telemetry events, errors, and messages.
abstract interface class TelemetryProviderDirectly declared public members:
String get name;The name of the provider.
String get title;The title of the provider.
String get description;The description of the provider.
Future<void> init();Initializes the provider.
Future<void> dispose();Disposes the provider.
Future<void> reportError(dynamic exception, {StackTrace? stackTrace, Map<String, dynamic>? params, bool fatal = false});Reports an error with an optional stack trace and parameters.
Future<void> reportFlutterError(FlutterErrorDetails details, {bool fatal = false});Reports a Flutter error with optional parameters.
Future<void> reportMessage(String message, {Map<String, dynamic>? params, LogLevel? level = LogLevel.info});Reports a message with optional parameters.
Future<Trace> startTrace(String name, String operation, {LogLevel? level = LogLevel.info});Starts a trace with a specific name and operation.
Trace
The base interface for a Telemetry Trace. The trace is responsible for tracking the duration of an operation, and reporting metrics and attributes.
abstract class TraceDirectly declared public members:
Future<void> stop();Stops or finalizes the trace.
void setMetric(String name, int value);Sets a metric with a specific name and value.
int getMetric(String name);Gets a metric with a specific name.
void setAttributes(Map<String, String> attributes);Sets an attribute with a specific name and value.
Map<String, String> getAttributes();Gets all attributes set so far in the trace.
Future<Trace> startChild(String name, String operation, {LogLevel? level = LogLevel.info});Starts a child trace with a specific name and operation.
TranslationRegistration
Registration for feature-specific translations
class TranslationRegistrationDirectly declared public members:
final String name;Name of the translation system (for debugging)
final Future<void> Function(Locale locale) onLocaleChange;Callback when locale changes (async to support deferred loading)
const TranslationRegistration({required this.name, required this.onLocaleChange});User
Represents a user of the application.
class UserDirectly declared public members:
final String id;The unique identifier of the user.
final String? name;The name of the user. This could include the first name, last name or display name.
final String? email;The email of the user.
final String? phoneNumber;The phone number of the user.
final String? photoUrl;The URL of the user's photo.
final LoginMethod loginMethod;The method used to login.
final DateTime? lastSignInTime;The last sign-in time of the user.
final DateTime? creationTime;The creation time of the user.
const User({required this.loginMethod, required this.id, this.name, this.email, this.phoneNumber, this.photoUrl, this.lastSignInTime, this.creationTime});Create a new user with the given parameters.
bool get isUnknown;Returns true if this user is the unknown user.
static const dynamic unknown;A constant unknown user.
VoidFutureFunction
A function that returns a void Future.
typedef VoidFutureFunction = Future<void> Function();VyuhBinding
Public declaration in this package.
final class VyuhBindingDirectly declared public members:
static VyuhBinding get instance;List<Plugin> get plugins;final PlatformWidgetBuilder widgetBuilder;final Future<void> widgetReady;bool get initInvoked;bool get initialized;void widgetInit({PluginDescriptor? plugins, PlatformWidgetBuilder? widgetBuilder, required ExtensionBuilder extensionBuilder, required List<ExtensionDescriptor> extensionDescriptors, Future<void> Function(VyuhBinding)? onReady});Runs Vyuh in widget mode: plugins and one extension builder, without runApp, features or a router. Packages that embed Vyuh widgets in a non-Vyuh app wrap this in their own binding API.
Future<void> dispose();T? get<T extends Plugin>();VyuhBranding
"Powered by Vyuh", shown when the theme allows it.
class VyuhBranding extends StatelessWidgetDirectly declared public members:
const VyuhBranding({super.key});Widget build(BuildContext context);VyuhEvent
Base class for all events in a Vyuh application.
class VyuhEvent<T>Directly declared public members:
final String name;The name of the event, used for identification and logging.
final DateTime timestamp;When the event was created.
final T? data;Optional data associated with the event.
VyuhEvent({required this.name, this.data});VyuhEventListener
A function that handles events of type T.
typedef VyuhEventListener<T extends VyuhEvent> = void Function(T event);VyuhFailure
A failure the framework shows to the user and reports to telemetry.
final class VyuhFailureDirectly declared public members:
final FailureKind kind;The category of the failure.
final String title;A short, user-facing title.
final String? message;An optional user-facing explanation.
final Object? error;The underlying error, shown only in debug builds.
final StackTrace? stackTrace;The stack trace of error, shown only in debug builds.
final Uri? location;The location that failed, when the failure belongs to a route.
final String? featureName;The feature involved, when known.
const VyuhFailure({required this.kind, required this.title, this.message, this.error, this.stackTrace, this.location, this.featureName});bool get canGoHome;Whether going to the home route can recover from this failure. Init failures happen before the router exists, so only restart helps.
String toString();VyuhFailureScope
Makes the current VyuhFailure available to error views below it.
class VyuhFailureScope extends InheritedWidgetDirectly declared public members:
final VyuhFailure failure;The failure being shown.
const VyuhFailureScope({super.key, required this.failure, required super.child});static VyuhFailure? maybeOf(BuildContext context);The nearest failure, or null when the view was built outside one.
bool updateShouldNotify(VyuhFailureScope oldWidget);VyuhPlatform
The base class for the Vyuh Platform. This class is responsible for initializing the platform and managing the lifecycle of the platform.
abstract class VyuhPlatformDirectly declared public members:
List<FeatureDescriptor> get features;A list of features currently registered and available on the platform.
List<Plugin> get plugins;A list of plugins available to the platform. Plugins provide extended functionalities and services to the platform.
PlatformWidgetBuilder get widgetBuilder;A builder function that creates platform-specific widgets. This allows for flexible UI customization based on the platform.
GlobalKey<NavigatorState> get rootNavigatorKey;The root navigator key. Used by the router plugin for navigation management within the application.
SystemInitTracker get tracker;Tracks the initialization status of the platform, including its features and plugins.
Future<void>? featureReady(String featureName);Verifies or waits for the specified feature to become ready.
Future<void> run();Initializes and runs the platform. This method is internally managed and should not be called directly.
Future<void> initPlugins(Trace parentTrace);Initializes the registered plugins for the platform. This method is internally managed and should not be called directly.
Future<void> initFeatures(Trace parentTrace);Initializes the features for the platform. This method is internally managed and should not be called directly.
T? getPlugin<T extends Plugin>();Retrieves a specific plugin instance based on the requested type T. Returns null if no plugin of the specified type is registered. There are named extensions already available for all the standard plugins. You use this method when writing a custom plugin which needs to be exposed with a named extension. Refer to the NamedPlugins extension for a practical example of exposing a named reference to a plugin.
ExtensionBuilder? extensionBuilder<T extends ExtensionDescriptor>();Gets the ExtensionBuilder given an extensionType
bool isFeatureLoaded(String featureName);Whether a feature (eager or lazy) has been loaded and is ready.
Future<void> loadFeature(String featureName);Programmatically load a lazy feature by name. If the feature is already loaded (eager or lazy), this is a no-op. Throws StateError if no feature with the given name is registered.
Future<void> dispose();VyuhStrings
Every user-facing string the framework shows: failure titles and messages, recovery actions and accessibility labels.
final class VyuhStringsDirectly declared public members:
final String tryAgain;Retry button.
final String goHome;Go-home button.
final String restartApp;Restart button, the last-resort recovery.
final String details;Heading of the debug-only details panel.
final String loading;Accessibility label of loaders.
final String contentUnavailable;Accessibility label of the placeholder for a widget that failed to build.
final String appStartFailedTitle;Title when the app fails to start.
final String appStartFailedMessage;Message when the app fails to start.
final String pageNotFoundTitle;Title when no route matches, or a page does not exist.
final String Function(Uri location) noRouteMessage;Message when no route matches location.
final String pageLoadFailedTitle;Title when a page could not be loaded.
final String contentNotFoundTitle;Title when a part of a page does not exist.
final String contentLoadFailedTitle;Title when a part of a page could not be loaded.
final String checkConnectionMessage;Message for failures that a retry may fix.
final String missingMessage;Message for something that is missing.
final String Function(String featureTitle) featureLoadFailedTitle;Title when the lazy feature titled featureTitle fails to load.
final String Function(String featureTitle) featureDisabledTitle;Title when the lazy feature titled featureTitle is turned off.
final String featureDisabledMessage;Message when a lazy feature is turned off.
const VyuhStrings({this.tryAgain = 'Try again', this.goHome = 'Go home', this.restartApp = 'Restart app', this.details = 'Details (debug only)', this.loading = 'Loading', this.contentUnavailable = 'Content unavailable', this.appStartFailedTitle = 'The app could not start', this.appStartFailedMessage = 'Something went wrong while starting up.', this.pageNotFoundTitle = 'Page not found', this.noRouteMessage = _noRouteMessage, this.pageLoadFailedTitle = 'This page could not be loaded', this.contentNotFoundTitle = 'Content not found', this.contentLoadFailedTitle = 'This content could not be loaded', this.checkConnectionMessage = 'Check your connection and try again.', this.missingMessage = 'It may have been moved or removed.', this.featureLoadFailedTitle = _featureLoadFailedTitle, this.featureDisabledTitle = _featureDisabledTitle, this.featureDisabledMessage = 'This part of the app is turned off right now.'});static VyuhStrings get current;The strings of the running app, or the defaults when none is running.
VyuhTheme
The app's themes, given once to PlatformWidgetBuilder.theme.
final class VyuhThemeDirectly declared public members:
final ThemeData light;The light theme. Also used when dark is not given.
final ThemeData? dark;The dark theme.
final ThemeMode mode;Which theme to use. Defaults to following the platform.
const VyuhTheme({required this.light, this.dark, this.mode = ThemeMode.system});factory VyuhTheme.fromSeed(Color seed, {ThemeMode mode = ThemeMode.system});Material 3 light and dark themes generated from one seed color.
static final VyuhTheme system;The framework default: Material 3 from a neutral indigo seed.
VyuhTheme copyWith({ThemeData? light, ThemeData? dark, ThemeMode? mode});A copy with the given fields replaced.
VyuhThemeExtension
Design tokens for the UI the framework draws itself.
final class VyuhThemeExtension extends ThemeExtension<VyuhThemeExtension>Directly declared public members:
final Color? appLoaderBackground;Background of the full-screen app loader.
final Color? loaderColor;Progress color of loaders.
final Color? routeLoaderBackground;Background behind a route that is loading.
final Color? placeholderBackground;Background of image and content placeholders.
final Color? placeholderForeground;Icon color of placeholders.
final Color? failureBackground;Background of the badge behind failure icons and of inline failures.
final Color? failureForeground;Icon and text color on failureBackground.
final Color? debugBackground;Background of debug-only diagnostics.
final Color? debugForeground;Text color of debug-only diagnostics.
final Color? debugBorder;Border color of debug-only diagnostics.
final double? radius;Corner radius of inline failures, placeholders and diagnostics.
final Duration? loaderDelay;How long a route or content loader waits before it appears, so fast loads don't flash.
final bool? showPoweredBy;Whether the app loader shows "Powered by Vyuh".
const VyuhThemeExtension({this.appLoaderBackground, this.loaderColor, this.routeLoaderBackground, this.placeholderBackground, this.placeholderForeground, this.failureBackground, this.failureForeground, this.debugBackground, this.debugForeground, this.debugBorder, this.radius, this.loaderDelay, this.showPoweredBy});factory VyuhThemeExtension.fallback(ColorScheme scheme);Fully resolved tokens for scheme.
static VyuhThemeExtension of(BuildContext context);The tokens for context: the theme's extension, with every missing token filled from its color scheme.
VyuhThemeExtension copyWith({Color? appLoaderBackground, Color? loaderColor, Color? routeLoaderBackground, Color? placeholderBackground, Color? placeholderForeground, Color? failureBackground, Color? failureForeground, Color? debugBackground, Color? debugForeground, Color? debugBorder, double? radius, Duration? loaderDelay, bool? showPoweredBy});VyuhThemeExtension lerp(VyuhThemeExtension? other, double t);debugAssertOneOfPathOrRouteId
Asserts only one of path or routeId is provided and not both. Asserts that only one of path or routeId is provided.
void debugAssertOneOfPathOrRouteId(String? path, String? routeId)defaultAppRunner
The default app runner that initializes Flutter bindings and runs the app using flutter.runApp.
void defaultAppRunner(Widget app)reportFailure
Reports a failure in one consistent way: to telemetry and, for route-level failures, as a RouteFailureEvent.
void reportFailure(VyuhFailure failure, {bool emitRouteEvent = true})runApp
The main entry point to kick off the Vyuh Application. This function should be called from the main function of the application. It initializes the Vyuh Platform and runs the application with given features and plugins.
void runApp({required FeaturesBuilder features, LazyFeaturesBuilder? lazyFeatures, PluginDescriptor? plugins, PlatformWidgetBuilder? platformWidgetBuilder, String? initialLocation, String? homeLocation, bool captureErrors = true, AppRunner? appRunner})vyuh
The platform interface for Vyuh. This tracks the instance of the platform and can be used to access various aspects of the framework.
VyuhPlatform vyuh = _UninitializedPlatform();