This will add a line like this to your package's pubspec.yaml
dependencies:....advertising_id:^2.7.1
Usage
AdvertisingId.id
Get advertising ID.
String? advertisingId;
// Platform messages may fail, so we use a try/catch PlatformException.try {
advertisingId = awaitAdvertisingId.id(true);
} onPlatformException {
advertisingId = null;
}
AdvertisingId.isLimitAdTrackingEnabled
Retrieves whether the user has limit ad tracking enabled or not.
bool? isLimitAdTrackingEnabled;
// Platform messages may fail, so we use a try/catch PlatformException.try {
isLimitAdTrackingEnabled = awaitAdvertisingId.isLimitAdTrackingEnabled;
} onPlatformException {
isLimitAdTrackingEnabled = false;
}