serverpod_live_flutter 0.1.1 copy "serverpod_live_flutter: ^0.1.1" to clipboard
serverpod_live_flutter: ^0.1.1 copied to clipboard

Flutter lifecycle support for Serverpod Live channels, collections, and presence.

example/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:serverpod_live_flutter/serverpod_live_flutter.dart';

void main() => runApp(const ExampleApp());

class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: TodoScreen());
  }
}

class TodoScreen extends StatefulWidget {
  const TodoScreen({super.key});

  @override
  State<TodoScreen> createState() => _TodoScreenState();
}

class _TodoScreenState extends State<TodoScreen> {
  late final LiveChannelLifecycle _liveLifecycle;

  @override
  void initState() {
    super.initState();
    _liveLifecycle = LiveChannelLifecycle();
    // Register the screen's LiveChannel, LiveCollection, or LivePresence here.
  }

  @override
  void dispose() {
    unawaited(_liveLifecycle.dispose());
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: Center(child: Text('A lifecycle-managed live todo screen')),
    );
  }
}
1
likes
160
points
14
downloads

Documentation

API reference

Publisher

verified publishersumitgohil.com

Weekly Downloads

Flutter lifecycle support for Serverpod Live channels, collections, and presence.

Repository (GitHub)
View/report issues

Topics

#serverpod #flutter #realtime

License

Apache-2.0 (license)

Dependencies

flutter, serverpod_live_client

More

Packages that depend on serverpod_live_flutter