Skip to main content
Migrating from v2 to v3 has breaking changes, as we have made some architectural level changes. Refer the v2 SDK documentation. Following are changes in detail:

Installation

v3 requires iOS 15.0+ (v2 supported iOS 13.0+) and Android minSdk 19. Bump the version in pubspec.yaml and the deployment target in ios/Podfile, then run flutter pub get and pod install inside the ios folder.
v3
v2

Initializing SDK

v2 needed platform-specific initialization: SSApi.init in your Android Application class and SuprSendSDKConfiguration in AppDelegate.swift. In v3 the SDK is initialized once from Dart in main, and all SDK methods can be accessed only after creating the instance. Remove the v2 native initialization code from both platforms.
v3
v2

Authentication changes

In v2, workspace key and workspace secret are used to authenticate requests made to SuprSend which is not so secure. They were also passed in native code, which means the secret was shipped inside your app binary. In v3 we have changed authentication to use public API Key (ApiKeys → Public Keys in dashboard) and Signed User Token. userToken is mandatory when enhanced security mode is on — refer docs to create it.
v3
v2

Asynchronous methods

In v2 all methods used to be fire-and-forget and have returned void. In background SDK used to batch requests and make API calls. In v3 every method returns a Future<SSResponse> so you could access response of API immediately depending on status of API call. Refer API response for the response structure.
v3
v2

Renamed class and methods

The lowercase suprsend class is now SuprSend, channel methods changed from set/unSet to add/remove, and push methods are no longer platform-specific. track and the user property methods (set, setOnce, increment, append, remove) keep their names, but now they are awaitable and their property argument is non-nullable.

Removed methods

Push notification setup changes

Push is still configured natively on each platform, but the integration steps changed. Refer Android push setup and iOS push setup for the complete v3 steps. Android — Firebase setup and the app.suprsend.fcm.SSFirebaseMessagingService registration in AndroidManifest.xml stay the same. Only the removed SSApi.init call and the manual token/notification flow need to be cleaned up. iOS — permission is requested with the standard UNUserNotificationCenter APIs instead of SuprSend.shared.registerForPushNotifications(options:), the APNs token is passed with SuprSendClient.shared.user.addiOSPush(token) instead of SuprSend.shared.setPushNotificationToken(token:), and notification callbacks are forwarded through SuprSendClient.shared.push. If you had added a Notification Service Extension, it now extends SuprSendNotificationService and only overrides publicKey().

Newly added in v3

After migrating please test all library methods to see if everything is working properly. If you face any issue in migration process please reach out to us on our slack community or drop an email to us on support@suprsend.com