TdLifecycle class final

Connects a TdRuntime to the Flutter app lifecycle.

  • Resumed: restarts the receive isolate if the OS stopped it, and sets online for authorized clients.
  • Hidden: sets online to false. TDLib keeps running; the OS decides how long a background app may run.
  • Exit requested (desktop): closes every client before the app quits, unless closeOnExit is false (e.g. the app hides to a tray instead).

Create it after WidgetsFlutterBinding.ensureInitialized() and keep it for the app's lifetime:

final runtime = await TdRuntime.start();
final lifecycle = TdLifecycle(runtime);

Constructors

TdLifecycle(TdRuntime runtime, {bool closeOnExit = true, bool manageOnlineStatus = true})
Starts observing the app lifecycle for runtime.

Properties

closeOnExit → bool
Close all TDLib clients when the app is asked to quit.
final
hashCode → int
The hash code for this object.
no setterinherited
manageOnlineStatus → bool
Toggle TDLib's online option with app visibility.
final
runtime → TdRuntime
The runtime being managed.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Stops observing the lifecycle.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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