20 lines
787 B
Dart
20 lines
787 B
Dart
import 'package:flutter/foundation.dart';
|
|
|
|
import 'bonsoir_server_discovery.dart';
|
|
import 'browser_server_discovery.dart';
|
|
import 'discovered_server.dart';
|
|
|
|
/// Finds Pipelines servers on the local network.
|
|
abstract interface class ServerDiscovery {
|
|
/// Browses while listened to. Each event is every server currently known;
|
|
/// a failure to browse is a stream error. Cancelling stops the browse.
|
|
Stream<List<DiscoveredServer>> scan();
|
|
}
|
|
|
|
/// The discovery this platform supports, or null where there is none.
|
|
///
|
|
/// Browsers ask their authenticated front door to browse its LAN. Native
|
|
/// clients browse directly through the platform DNS-SD service.
|
|
ServerDiscovery? platformServerDiscovery({bool web = kIsWeb}) =>
|
|
web ? BrowserServerDiscovery() : BonsoirServerDiscovery();
|