FlutterLifetime class
Bridges the Host lifecycle to Flutter's runApp and lifecycle events.
Responsibilities:
- Starts the Flutter app when the host signals
applicationStarted. - Wires Flutter error handlers into the host's logging pipeline.
- Logs lifecycle transitions (pause/resume/etc.) unless suppressed.
Typical usage (via addFlutter + runApp):
final builder = Host.createApplicationBuilder()
..addLogging((logging) => logging.addSimpleConsole())
..services.addFlutter((flutter) {
flutter.runApp((sp) => MyApp(services: sp));
});
final host = builder.build();
Future<void> main() async => host.run();
- Implemented types
Constructors
-
FlutterLifetime(Widget application, ErrorHandler errorHandler, HostEnvironment environment, HostApplicationLifetime applicationLifetime, Options<
FlutterLifetimeOptions> options, LoggerFactory loggerFactory) - Creates the Flutter host lifetime implementation.
Properties
- applicationLifetime → FlutterApplicationLifetime
-
The Flutter-specific application lifetime.
no setter
- environment → HostEnvironment
-
The host environment used for status messages and diagnostics.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
stop(
CancellationToken cancellationToken) → Future< void> -
Requests application shutdown via the host lifetime.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
waitForStart(
CancellationToken cancellationToken) → Future< void> -
Registers start callbacks and starts Flutter when the host starts.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited