serverpod_live_flutter 0.1.1
serverpod_live_flutter: ^0.1.1 copied to clipboard
Flutter lifecycle support for Serverpod Live channels, collections, and presence.
serverpod_live_flutter #
Flutter lifecycle support for serverpod_live_client, with no state-management
dependency.
Install #
dependencies:
serverpod_live_flutter: ^0.1.0
Manage app lifecycle #
Register the live resources owned by a screen or feature. The lifecycle owner pauses them while the application is in the background, resumes them on the foreground, and disposes every resource when its owner is disposed.
final lifecycle = LiveChannelLifecycle()
..register(channel)
..registerCollection(cards)
..registerPresence(presence);
@override
void dispose() {
unawaited(lifecycle.dispose());
super.dispose();
}
Collections resume from their saved cursor and reload an authoritative snapshot when a retention resync is required. Presence is ephemeral and rejoins with its configured identity. The behavior is identical for local and Redis-backed Serverpod Live deployments.
Example #
example/main.dart is a minimal Flutter app that creates
and disposes a lifecycle owner with its screen.
For server setup and complete examples, see the repository README.