extensions_flutter library

To use, import package:extensions_flutter/extensions_flutter.dart

Classes

ApplicationLifetime
Allows consumers to perform cleanup during a graceful shutdown.
AsyncDisposable
Provides a mechanism for releasing unmanaged resources asynchronously.
AsyncServiceScope
A ServiceScope implementation that implements AsyncDisposable.
BackgroundService
Base class for implementing a long running HostedService.
BufferedLogger
Enables logging providers to handle batched log entries.
BufferedLogRecord
Represents a buffered log record to be written in batch to a buffered logger.
BufferedLogRecordImpl
Default implementation of BufferedLogRecord.
CallbackNode
All of the state associated a registered callback, in a node that's part of a linked list of registered callbacks.
CancellationCallbackInfo
CancellationToken
Propagates notification that operations should be canceled.
CancellationTokenRegistration
CancellationTokenSource
Signals to a CancellationToken that it should be canceled.
ChainedConfigurationProvider
Chained implementation of ConfigurationProvider.
ChainedConfigurationSource
Represents a chained Configuration as a ConfigurationSource.
CommandLineConfigurationProvider
A command line based ConfigurationProvider.
CommandLineConfigurationSource
Represents command line arguments as an ConfigurationSource.
ConfigurationBuilder
Used to build key/value based configuration settings for use in an application.
ConfigurationBuilderProperties
ConfigurationChangeTokenSource<TOptions>
Creates ChangeTokens so that OptionsMonitor gets notified when Configuration changes.
ConfigurationManager
ConfigurationManager is a mutable configuration object. It is both an ConfigurationBuilder and an ConfigurationRoot. As sources are added, it updates its current view of configuration.
ConfigurationPath
Utility methods and constants for manipulating Configuration paths
ConfigurationProvider
Provides configuration key/values for an application.
ConfigurationReloadToken
Implements ChangeToken.
ConfigurationRoot
Represents the root of an Configuration hierarchy.
ConfigurationSection
Represents a section of application configuration values.
ConfigurationSource
Represents a source of configuration key/values for an application.
ConfigurationSources
ConfigureNamedOptions<TOptions>
Represents something that configures the TOptions type.
ConfigureOptions<TOptions>
Represents something that configures the TOptions type. Note: These are run before all PostConfigureOptions.
ConsoleFormatter
Allows custom log message formatting for console output.
ConsoleFormatterNames
Reserved formatter names for built-in console formatters.
ConsoleFormatterOptions
Base options class for console log formatters.
ConsoleLogger
A logger that writes messages to the console output.
ConsoleLoggerProvider
The provider for the ConsoleLogger.
DebugLogger
A logger that writes messages in the debug output window only when a debugger is attached.
DebugLoggerProvider
The provider for the DebugLogger.
DefaultHostApplicationBuilder
Represents a hosted applications and services builder that helps manage configuration, logging, lifetime, and more.
DefaultHostBuilder
DefaultLoggerLevelConfigureOptions
DefaultServiceFactoryAdapter<TContainerBuilder>
DefaultServiceProviderFactory
Default implementation of ServiceProviderFactory<TContainerBuilder>.
Disposable
Provides a mechanism for releasing unmanaged resources.
Environments
Commonly used environment names.
ErrorHandler
EventId
Identifies a logging event.
FileConfigurationProvider
Provides the base class for file-based ConfigurationProvider providers.
FileConfigurationSource
Represents a base class for file based ConfigurationSource.
FileLoadExceptionContext
Contains information about a file load exception.
FlutterApplicationLifetime
Manages Flutter-specific application lifecycle events.
FlutterBuilder
An interface for configuring Flutter.
FlutterErrorHandler
FlutterLifecycleObserver
Widget used to monitor lifecycle event changes
FlutterLifetime
Bridges the Host lifecycle to Flutter's runApp and lifecycle events.
FlutterLifetimeOptions
FormattedConsoleLogger
A logger that writes formatted messages to the console output.
FormattedConsoleLoggerProvider
Provider for FormattedConsoleLogger instances.
Host
A program abstraction.
HostApplicationBuilder
Represents a hosted applications and services builder which helps manage configuration, logging, lifetime, and more.
HostApplicationBuilderSettings
Settings for constructing an HostApplicationBuilder.
HostApplicationLifetime
Allows consumers to be notified of application lifetime events. This interface is not intended to be user-replaceable.
HostBuilder
A program initialization abstraction.
HostBuilderAdapter
HostBuilderContext
Context containing the common services on the Host. Some properties may be null until set by the Host.
HostDefaults
Constants for HostBuilder configuration keys.
HostedService
Defines methods for objects that are managed by the host.
HostEnvironment
Provides information about the hosting environment an application is running in.
HostingEnvironment
HostLifetime
Tracks host lifetime.
IConfiguration
Represents a set of key/value application configuration properties.
IConfigurationSection
Represents a section of application configuration values.
IniConfigurationParser
Parses INI configuration data into key-value pairs.
IniConfigurationProvider
An INI based ConfigurationProvider.
IniConfigurationSource
Represents an INI configuration string as a ConfigurationSource.
IniStreamConfigurationProvider
INI configuration provider that reads from a stream.
IniStreamConfigurationSource
Represents an INI stream as a ConfigurationSource.
JsonConfigurationParser
JsonConfigurationProvider
A JSON based ConfigurationProvider.
JsonConfigurationSource
JsonConsoleFormatter
A console formatter that formats log messages as JSON.
JsonConsoleFormatterOptions
Options for the built-in JSON console log formatter.
JsonFileConfigurationProvider
A JSON file based FileConfigurationProvider.
JsonFileConfigurationSource
Represents a JSON file as a ConfigurationSource.
LinkedNCancellationTokenSource
LogDefineOptions
Options for configuring logger message delegates.
LogEntry<TState>
Holds information about a log entry.
Logger
Represents a type used to perform logging.
LoggerFactory
Represents a type used to configure the logging system and create instances of Logger from the registered LoggerProviders.
LoggerFactoryOptions
The options for a LoggerFactory.
LoggerFilterOptions
The options for a LoggerFilter.
LoggerFilterRule
Defines a rule used to filter log messages.
LoggerMessage
Creates delegates for logging that can be cached and reused for improved performance.
LoggerProvider
Represents a type that can create instances of Logger.
LoggerProviderConfiguration<T>
Provides configuration for a specific logger provider type.
LoggerProviderConfigurationFactory
Factory to provide configuration for logger providers.
LoggerProviderConfigurationFactoryImpl
Factory implementation for providing configuration to logger providers.
LoggerProviderConfigurationImpl<T>
Implementation of ILoggerProviderConfiguration that retrieves configuration for a specific logger provider type.
LoggingBuilder
An interface for configuring logging providers.
LoggingConfiguration
Loads logging configuration from Configuration.
MemoryConfigurationProvider
In-memory implementation of ConfigurationProvider
MemoryConfigurationSource
Represents in-memory data as an ConfigurationSource.
NullLogger
Minimalistic logger that does nothing.
NullLoggerFactory
An LoggerFactory used to create instance of NullLogger that logs nothing.
NullScope
An empty scope without any logic.
NullTypedLogger<T>
Generic null logger that does nothing.
Options<TOptions>
Used to retrieve configured TOptions instances.
OptionsChangeTokenSource<TOptions>
Used to fetch ChangeToken used for tracking options changes.
OptionsFactory<TOptions>
Used to create TOptions instances.
OptionsMonitor<TOptions>
Used for notifications when TOptions instances change.
OptionsMonitorCache<TOptions>
Used by OptionsMonitor to cache TOptions instances.
OptionsSnapshot<TOptions>
Used to access the value of TOptions for the lifetime of a request.
PostConfigureOptions<TOptions>
Represents something that configures the TOptions type.
ProviderAliasUtilities
Utilities for working with logger provider aliases.
Registrations
Set of all the registrations in the token source.
Scope
ServiceCollection
Specifies the contract for a collection of service descriptors.
ServiceDescriptor
Describes a service with its service type, implementation, and lifetime.
ServiceFactoryAdapter
ServiceProvider
Defines a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.
ServiceProviderFactory<TContainerBuilder>
Provides an extension point for creating a container specific builder and a ServiceProvider.
ServiceProviderIsKeyedService
Optional service used to determine if the specified type with the specified service key is available from the ServiceProvider.
ServiceProviderIsService
Optional service used to determine if the specified type is available from the ServiceProvider.
ServiceProviderOptions
Options for configuring various behaviors of the default ServiceProvider implementation.
ServiceProviderScope
An InheritedWidget that provides access to the service provider.
ServiceScope
The dispose() method ends the scope lifetime. Once dispose is called, any scoped services that have been resolved from ServiceProvider will be disposed.
ServiceScopeFactory
A factory for creating instances of ServiceScope, which is used to create services within a scope.
SimpleConsoleFormatter
A simple console formatter that formats log messages with timestamps, log levels, categories, and exception details.
SimpleConsoleFormatterOptions
Options for the built-in simple console log formatter.
StaticFilterOptionsMonitor
StreamConfigurationProvider
Stream based configuration provider
StreamConfigurationSource
Stream based ConfigurationSource.
SupportRequiredService
Optional contract used by ServiceProviderServiceExtensions.getRequiredService() to resolve services if supported by ServiceProvider.
SystemdConsoleFormatter
A console formatter that formats log messages for systemd journal.
SystemdConsoleFormatterOptions
Options for the built-in systemd console log formatter.
TypedLogger<T>
A generic logger interface used to enable activation of a named logger from dependency injection.
TypedLoggerImpl<T>
Implementation of TypedLogger that wraps an underlying logger instance.
ValidateOptions<TOptions>
Interface used to validate options.
ValidateOptions0<TOptions>
Implementation of ValidateOptions<TOptions>
ValidateOptions1<TOptions, TDep>
ValidateOptions2<TOptions, TDep1, TDep2>
ValidateOptions3<TOptions, TDep1, TDep2, TDep3>
ValidateOptions4<TOptions, TDep1, TDep2, TDep3, TDep4>
ValidateOptions5<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5>
ValidateOptionsResult
Represents the result of an options validation.
WrappedWidget
A concrete holder for a WrappedWidgetFactory.
XmlConfigurationParser
Parses XML configuration data into key-value pairs.
XmlConfigurationProvider
An XML based ConfigurationProvider.
XmlConfigurationSource
Represents an XML configuration string as a ConfigurationSource.
XmlStreamConfigurationProvider
XML configuration provider that reads from a stream.
XmlStreamConfigurationSource
Represents an XML stream as a ConfigurationSource.

Enums

LoggerColorBehavior
Describes when to use color when logging messages.
LogLevel
ServiceLifetime
Specifies the lifetime of a service in a ServiceCollection.

Mixins

ConfigurationProviderMixin
Provides configuration key/values for an application.
EnumFlags

Extensions

ChainedBuilderExtensions on ConfigurationBuilder
Extension methods for adding Configuration to a ConfigurationBuilder.
CommandLineConfigurationExtensions on ConfigurationBuilder
Extension methods for registering CommandLineConfigurationProvider with ConfigurationBuilder.
ConfigurationExtensions on Configuration
Extension methods for configuration classes.
ConfigurationRootExtensions on ConfigurationRoot
Extension methods for ConfigurationRoot.
ConfigurationSectionExtensions on ConfigurationSection
Extension methods for configuration section classes.
ConsoleLoggerFactoryExtensions on LoggingBuilder
Extension methods for the LoggerFactory class.
DebugLoggerFactoryExtensions on LoggingBuilder
Extension methods for the LoggerFactory class.
EnumFlagsExtension on int
FileConfigurationExtensions on ConfigurationBuilder
Provides extension methods for file-based configuration providers.
FilterLoggingBuilderExtensions on LoggingBuilder
Extension methods for setting up logging services in an ServiceCollection.
FlutterBuilderExtensions on FlutterBuilder
Extension methods for configuring Flutter applications via FlutterBuilder.
FlutterHostExtensions on Host
Adds convenience menthods to the Host.
FlutterServiceCollectionExtensions on ServiceCollection
Extension methods for adding Flutter support to a ServiceCollection.
HostEnvironmentEnvExtensions on HostEnvironment
Extension methods for HostEnvironment.
HostingAbstractionsHostBuilderExtensions on HostBuilder
Provides extension methods for the HostBuilder from the hosting abstractions package.
HostingAbstractionsHostExtensions on Host
HostingEnvironmentExtensions on HostingEnvironment
HostingHostBuilderExtensions on HostBuilder
Provides extension methods for the HostBuilder from the hosting package.
IniConfigurationExtensions on ConfigurationBuilder
Extension methods for adding INI configuration sources.
InternalConfigurationRootExtensions on ConfigurationRoot
Extensions method for ConfigurationRoot.
JsonConfigurationExtensions on ConfigurationBuilder
Extension methods for adding JsonConfigurationProvider.
LoggerExtensions on Logger
LoggerFactoryExtensions on LoggerFactory
LoggerFactory extension methods for common scenarios.
LoggerFilterOptionsExtensions on LoggerFilterOptions
LoggingBuilderConfigurationExtensions on LoggingBuilder
Extension methods for configuring logging from IConfiguration.
LoggingBuilderExtensions on LoggingBuilder
Extension methods for setting up logging services in a LoggingBuilder.
LoggingServiceCollectionExtensions on ServiceCollection
Extension methods for setting up logging services in a ServiceCollection.
LogLevelExtensions on LogLevel
MemoryConfigurationBuilderExtensions on ConfigurationBuilder
ConfigurationBuilder extension methods for the MemoryConfigurationProvider.
OptionsBuilderExtensions on OptionsBuilder<TOptions>
OptionsServiceCollectionExtensions on ServiceCollection
Extension methods for adding options services to the DI container.
ServiceCollectionContainerBuilderExtensions on ServiceCollection
Extension methods for building a ServiceProvider from a ServiceCollection.
ServiceCollectionDescriptorExtensions on ServiceCollection
Extension methods for adding and removing services to an ServiceCollection.
ServiceCollectionHostedServiceExtensions on ServiceCollection
Extension methods for adding hosted services to a ServiceCollection.
ServiceCollectionServiceExtensions on ServiceCollection
Extension methods for adding services to a ServiceCollection.
ServiceProviderContext on BuildContext
Extension methods for convenient service access from BuildContext.
ServiceProviderExtensions on ServiceProvider
Convenience methods for ServiceProvider.
ServiceProviderKeyedServiceExtensions on ServiceProvider
Extension methods for getting services from a ServiceProvider.
ServiceProviderServiceExtensions on ServiceProvider
Extension methods for getting services from a ServiceProvider.
ServiceScopeFactoryExtensions on ServiceScopeFactory
Extension methods for getting services from a ServiceScopeFactory.
TypedLoggerFactoryExtensions on LoggerFactory
Extension methods for creating typed loggers.
XmlConfigurationExtensions on ConfigurationBuilder
Extension methods for adding XML configuration sources.

Functions

configurationKeyComparator(String? x, String? y) int
createApplicationBuilder({HostApplicationBuilderSettings? settings}) HostApplicationBuilder
createDefaultBuilder([List<String>? args]) HostBuilder
Initializes a new instance of the HostBuilder class with pre-configured defaults.
equals(String value1, String value2, {bool ignoreCase = true}) bool
isNullOrEmpty(String? value) bool
isNullOrWhitespace(String? value) bool

Typedefs

CallbackRegistration = void Function(Object? state)
CancellationCallback = void Function(Object? state)
CategoryLevelFilterAction = bool Function(String? category, LogLevel level)
Configuration = IConfiguration
Alias for IConfiguration for backwards compatibility.
ConfigureAction = void Function(FlutterBuilder builder)
A configuration callback for the FlutterBuilder.
ConfigureAppConfigurationDelegate = void Function(HostBuilderContext context, ConfigurationBuilder configuration)
ConfigureContainer<TContainerBuilder> = void Function(TContainerBuilder containerBuilder)
ConfigureContainerBuilder<TContainerBuilder> = void Function(TContainerBuilder containerBuilder)
ConfigureContainerDelegate<TContainerBuilder> = TContainerBuilder Function(HostBuilderContext context, TContainerBuilder builder)
ConfigureDefaultServiceProvider = void Function(HostBuilderContext context, ServiceProviderOptions options)
ConfigureFilter = bool Function(String name, String category, LogLevel level)
ConfigureFlutterOptions = void Function(FlutterLifetimeOptions options)
A configuration callback for FlutterLifetimeOptions.
ConfigureHostConfigurationDelegate = void Function(ConfigurationBuilder configuration)
ConfigureLoggerFactoryOptions = void Function(LoggerFactoryOptions options)
ConfigureLoggingBuilder = void Function(LoggingBuilder builder)
ConfigureOptionsAction1 = void Function(LoggerFilterOptions options)
ConfigureServicesDelegate = void Function(HostBuilderContext context, ServiceCollection services)
ContextResolver = HostBuilderContext? Function()
CreateServiceProvider = ServiceProvider Function()
FactoryResolver<TContainerBuilder> = ServiceProviderFactory<TContainerBuilder> Function(HostBuilderContext hostContext)
FilterAction = bool Function(String provider, String category, LogLevel level)
FlutterAppBuilder = Widget Function(ServiceProvider services)
A builder function that creates the root application widget.
ImplementationFactory = Object Function(ServiceProvider services)
A factory to create new instances of the service implementation.
KeyedImplementationFactory = Object Function(ServiceProvider services, Object? serviceKey)
LevelFilterAction = bool Function(LogLevel level)
LogFormatter<TState> = String Function(TState state, Object? error)
Function to create a String message of the state and exception.
ServiceProviderFactoryDelegate<TContainerBuilder> = ServiceProviderFactory<TContainerBuilder> Function(HostBuilderContext? context)
Task = Future<void>
TimerCallback = void Function(Object? state)
TypedImplementationFactory<T> = T Function(ServiceProvider services)
TypedKeyedImplementationFactory<T> = T Function(ServiceProvider services, Object? serviceKey)
ValidationCallback0<TOptions> = bool Function(TOptions options)
ValidationCallback1<TOptions, TDep> = bool Function(TOptions options, TDep dependency)
ValidationCallback2<TOptions, TDep1, TDep2> = bool Function(TOptions options, TDep1 dependency1, TDep2 dependency2)
ValidationCallback3<TOptions, TDep1, TDep2, TDep3> = bool Function(TOptions options, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3)
ValidationCallback4<TOptions, TDep1, TDep2, TDep3, TDep4> = bool Function(TOptions options, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4)
ValidationCallback5<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5> = bool Function(TOptions options, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, TDep5 dependency5)
WrappedWidgetFactory = Widget Function(ServiceProvider sp, Widget child)
A factory function that wraps a widget with another widget.

Exceptions / Errors

ArgumentException
The exception that is thrown when one of the arguments provided to a method is not valid.
ArgumentNullException
An exception that is thrown when a method is invoked and at least one of the passed arguments is null but should never be null.
FileSystemException
An exception thrown when a file-based configuration source cannot be read.
ObjectDisposedException
/// The exception that is thrown when accessing an object that was disposed.
OperationCanceledException
The exception that is thrown in a thread upon cancellation of an operation that the thread was executing.
SystemException
This class is provided as a means to differentiate between system exceptions and application exceptions.