getId method
Future<String>
getId({
- AndroidIdSource androidSource = AndroidIdSource.androidId,
- String? initialValue,
override
Returns the stable identifier of this device.
Implementation
@override
Future<String> getId({
AndroidIdSource androidSource = AndroidIdSource.androidId,
String? initialValue,
}) async {
final id = await methodChannel.invokeMethod<String>(_getIdMethod, {
_androidSourceArgument: androidSource.name,
_initialValueArgument: initialValue,
});
if (id == null || id.isEmpty) {
throw PlatformException(
code: _unavailableErrorCode,
message: 'The platform returned an empty device identifier.',
);
}
return id;
}