Skip to main content

flutter_freedome_connectivity 1.2.0 copy "flutter_freedome_connectivity: ^1.2.0" to clipboard
flutter_freedome_connectivity: ^1.2.0 copied to clipboard

FreeDome connectivity for Flutter: discovery of FreeDome dome systems on the local network, Socket.IO / WebSocket / HTTP connections, events and commands.

example/main.dart

// Minimal example: discover FreeDome systems on the local network and connect to the first one.
import 'package:flutter/material.dart';
import 'package:flutter_freedome_connectivity/flutter_freedome_connectivity.dart';

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

/// Lists discovered dome systems; tap one to connect.
class ConnectivityExampleApp extends StatefulWidget {
  /// Creates the example app.
  const ConnectivityExampleApp({super.key});

  @override
  State<ConnectivityExampleApp> createState() => _ConnectivityExampleAppState();
}

class _ConnectivityExampleAppState extends State<ConnectivityExampleApp> {
  final FreeDomeConnectionService _connection = FreeDomeConnectionService();

  @override
  void initState() {
    super.initState();
    _connection.addListener(_onChanged);
    _connection.initialize().then((_) => _connection.startDiscovery());
  }

  void _onChanged() => setState(() {});

  @override
  void dispose() {
    _connection.removeListener(_onChanged);
    _connection.stopDiscovery();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    final systems = _connection.discoveredSystems;
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text(
            _connection.isConnected
                ? 'Connected: ${_connection.activeDome?.name}'
                : 'FreeDome systems',
          ),
        ),
        body: ListView(
          children: [
            for (final system in systems)
              ListTile(
                title: Text(system.name),
                subtitle: Text('${system.ipAddress}:${system.port}'),
                onTap: () => _connection.connectToDome(system),
              ),
          ],
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: _connection.refreshSystems,
          child: const Icon(Icons.refresh),
        ),
      ),
    );
  }
}
0
likes
150
points
67
downloads

Documentation

API reference

Publisher

verified publisherfreedome.nativemind.net

Weekly Downloads

FreeDome connectivity for Flutter: discovery of FreeDome dome systems on the local network, Socket.IO / WebSocket / HTTP connections, events and commands.

Homepage
Repository (GitLab)

License

unknown (license)

Dependencies

flutter, flutter_localizations, freedome_client, freedome_protocol, http, intl, json_annotation, socket_io_client

More

Packages that depend on flutter_freedome_connectivity