getId method

  1. @override
Future<String> getId({
  1. String? initialValue,
})
override

Returns the stable identifier of this device.

Implementation

@override
Future<String> getId({String? initialValue}) async {
  final id = await methodChannel.invokeMethod<String>(_getIdMethod, {
    _initialValueArgument: initialValue,
  });
  if (id == null || id.isEmpty) {
    throw PlatformException(
      code: _unavailableErrorCode,
      message: 'The platform returned an empty device identifier.',
    );
  }
  return id;
}