Flutter Plugin Integration Guide
Flutter Plugin Integration
Add the bonree_flutter_plugin plugin in the pubspec.yaml file. Both local and remote dependencies are supported (choose one method).
- Add Dependency
Local Dependency:
Open pubspec.yaml, add bonree_flutter_plugin: under dependencies, and specify the local path, for example:
dependencies:
bonree_flutter_plugin:
path: ./bonree_flutter_plugin # Write the local path of the bonree_flutter_plugin package here
Remote Dependency:
Open pubspec.yaml, add bonree_flutter_plugin: under dependencies, as shown below:
dependencies:
bonree_flutter_plugin:
If necessary, add version constraints based on actual requirements, for example:
dependencies:
bonree_flutter_plugin: ^3.0.0
-
Execute the
flutter packages getcommand. -
For iOS, navigate to the
iosdirectory in your project and execute:pod install. -
Import the package and replace runApp()
import 'package:bonree_flutter_plugin/bonree_flutter_plugin.dart';
void main() {
// runApp(MyApp());// Comment out the original runApp() method
Bonree().start(MyApp());
}
During runtime, the following log in Flutter indicates successful integration:
[INFO][BONREE]: bonree_flutter_plugin start success
BonreeSDK Integration
Refer to the integration sections in the Help Center: Android-Native and iOS-Native.