CuBid Flutter
The official Flutter plugin for CuBid advertising on Android and iOS. It supports banner, native, interstitial, and rewarded ads.
Valid CuBid credentials and placement IDs are required. Credentials are provided through official CuBid programs.
Requirements
- Flutter 3.3 or newer
- Dart 3.9 or newer
- Android API 24 or newer
- iOS 14.0 or newer
Installation
Add the plugin to your application:
dependencies:
cubid_flutter: ^2.0.0
Then install dependencies:
flutter pub get
Initialization
final cubid = CubidFlutter();
await cubid.initialize(
setId: 'YOUR_SET_ID',
userId: 'YOUR_USER_ID',
onInitialized: () {
print('CuBid initialized');
},
onFailed: (CubidError error) {
print('CuBid initialization failed: ${error.code} ${error.message}');
},
);
Errors
All asynchronous CuBid SDK failures are exposed as CubidError:
class CubidError {
final int? code;
final String message;
}
Native ad failures use the same type:
CubidNativeAd(
placementId: 'YOUR_PLACEMENT_ID',
factoryId: 'default',
onFailed: (error) {
print('${error.code}: ${error.message}');
},
)
Interstitial and rewarded streams expose errors on their events:
interstitial.events.listen((event) {
final error = event.error;
if (error != null) {
print('${error.code}: ${error.message}');
}
});
code can be null only when an older native plugin or a native initialization callback supplies a message without a recognizable CuBid code.
See the complete application in example/.
For onboarding and SDK documentation, visit the CuBid project.