Import the SDK
Requirements
- Dart: ≥ 2.15.0 < 4.0.0
- Flutter: ≥ 2.5.0
Install the SDK
The Chat SDK for Flutter is distributed as a plugin package that includes both the Dart layer and native Android and iOS platform code.
-
Add the dependency to your project's
pubspec.yaml.yamldependencies:
flutter:
sdk: flutter
rongcloud_im_wrapper_plugin: x.y.ztipReplace
x.y.zwith the version you want to use. Check the official repository for the latest version. The first three digits of the Flutter plugin version match the native SDK version. For example, Flutter SDK version5.2.4uses native SDK version5.2.4. -
Run
flutter pub getin your project directory to download the plugin. -
Import the package.
Dartimport 'package:rongcloud_im_wrapper_plugin/rongcloud_im_wrapper_plugin.dart';
Disable Android code obfuscation
For ProGuard rules, see the Android documentation.
If you don't need obfuscation, disable it. Otherwise, flutter build apk may obfuscate Android code and cause .so library errors.
Groovy
android {
buildTypes {
release {
// Enables code shrinking, obfuscation, and optimization for only
// your project's release build type.
minifyEnabled false
// Enables resource shrinking, which is performed by the
// Android Gradle plugin.
shrinkResources false
}
}
...
}