advertising_id
2.7.1, released 2 years ago by an unverified publisher
Access the advertising ID on iOS and Android.
WASM-readyRepository archived
What it does
Provides a simple API to retrieve the advertising ID and check if limit ad tracking is enabled. It wraps the native platform services for iOS and Android.
AI-written summary of version 2.7.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need the advertising ID for analytics or ad targeting.
- You want to respect the user’s limit ad tracking setting.
Skip it when
- You are building a web or desktop app, as the plugin only supports mobile.
Strengths
- Simple API, no build_runner or code generation required.
- Keeps native dependencies up to date with recent Android and iOS changes.
Weaknesses
- Only works on mobile platforms.
- No support for web or desktop.
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Add dependency to pubspec and run flutter pub get. No additional native configuration is required beyond the plugin’s defaults.
```dart
import 'package:advertising_id/advertising_id.dart';
Future<void> getAdInfo() async {
try {
final id = await AdvertisingId.id(true);
final limit = await AdvertisingId.isLimitAdTrackingEnabled;
print('ID: $id, limit: $limit');
} on PlatformException {
print('Failed to get advertising info');
}
}
```