mobsur_flutter_sdk 1.0.2 mobsur_flutter_sdk: ^1.0.2 copied to clipboard
Flutter SDK for mobsur.com
MobSur Flutter SDK #
More information on https://mobsur.com
Usage #
- Add this package as dependency in
pubspec.yml
dependencies:
mobsur_flutter_sdk: ^1.0.2
Then run
flutter pub get
- Import it in your project
import 'package:mobsur_flutter_sdk/mobsur_flutter_sdk.dart';
- Call the setup method.
void main() {
WidgetsFlutterBinding.ensureInitialized()
// You can call this method somewhere else in the app instead,
// but it should not be right before an event, that should trigger a survey
MobSurSDK().setup('YOUR-APP-ID', 'user-id');
runApp(const MyApp());
}
- Call the event method, passing the build context.
MobSurSDK().logEvent('event-name-here', context);
- If you do not know the client id during the setup, you can pass it later. The client id can't be empty string.
MobSurSDK().updateClientId('client-id-here');
Recommendation #
Call the event method in a wrapper class that manages your events. If you already have events in the app, it's a good idea to call the method for all the events and then, the correct one will be selected in the dashboard.