Files
nearby_service/lib/nearby_service_platform_interface.dart
T
Kseniia Nikitina 7049c39cf0 BREAKING CHANGE: Update API for connection, communication channel state and is browser value (#14)
* refactor(lib, example, example_full): use streams for communication channel and is ios browser

* feat: add abstract toJson() to message

* refactor: add deprecations for nearby_service

* feat(example): update main.dart

* feat(nearby_service): add comments

* feat(nearby_service_platform_interface): add deprecation to getConnectedDeviceStream

* feat(nearby_service/message): add concrete implementation for toJson()

* feat(nearby_service/android): add deprecations

* fix(nearby_service/android): reset check for android device

* fix(nearby_service/ios): change ios service to deprecations variant

* chore(nearby_service): edit deprecation messages

* chore: update gitignore

* doc: add CONTRIBUTING file

* doc: update CONTRIBUTING file

* chore: update CONTRIBUTING.md

* chore: update CONTRIBUTING.md

* chore: version 0.1.0

* fix(example_full): move startListeningCommunicationChannelState() upper
2024-08-18 15:42:53 +02:00

70 lines
2.3 KiB
Dart

import 'package:nearby_service/nearby_service.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'nearby_service_method_channel.dart';
abstract class NearbyServicePlatform extends PlatformInterface {
NearbyServicePlatform() : super(token: _token);
static final Object _token = Object();
static NearbyServicePlatform _instance = MethodChannelNearbyService();
/// The default instance of [NearbyServicePlatform] to use.
///
/// Defaults to [MethodChannelNearbyService].
static NearbyServicePlatform get instance => _instance;
/// Platform-specific implementations should set this with their own
/// platform-specific class that extends [NearbyServicePlatform] when
/// they register themselves.
static set instance(NearbyServicePlatform instance) {
PlatformInterface.verifyToken(instance, _token);
_instance = instance;
}
Future<String?> getPlatformVersion() {
throw UnimplementedError('platformVersion() has not been implemented.');
}
Future<String?> getPlatformModel() {
throw UnimplementedError('getPlatformModel() has not been implemented.');
}
Future<NearbyDeviceInfo?> getCurrentDeviceInfo() {
throw UnimplementedError('getCurrentDevice() has not been implemented.');
}
Future<void> openServicesSettings() {
throw UnimplementedError(
'openServicesSettings() has not been implemented.');
}
Future<List<NearbyDevice>> getPeers() {
throw UnimplementedError('getPeers() has not been implemented.');
}
Stream<List<NearbyDevice>> getPeersStream() {
throw UnimplementedError('streamPeers() has not been implemented.');
}
@Deprecated('Use getConnectedDeviceStreamById instead')
Stream<NearbyDevice?> getConnectedDeviceStream(NearbyDevice device) {
throw UnimplementedError(
'getConnectedDeviceStream() has not been implemented.');
}
Stream<NearbyDevice?> getConnectedDeviceStreamById(String deviceId) {
throw UnimplementedError(
'getConnectedDeviceStreamById() has not been implemented.',
);
}
@Deprecated(
'This method will be removed. Method disconnect is platform-specific and you should use NearbyServiceIOSPlatform.disconnectById or NearbyServiceAndroidPlatform.disconnectById instead.',
)
Future<bool> disconnect(NearbyDevice device) {
throw UnimplementedError('disconnect() has not been implemented.');
}
}