mobiqo_flutter 0.0.6 copy "mobiqo_flutter: ^0.0.6" to clipboard
mobiqo_flutter: ^0.0.6 copied to clipboard

Mobiqo SDK for Flutter. Integrate with Mobiqo for user analytics, predictions, and insights.

Mobiqo Flutter SDK #

⚠️ THIS PLUGIN HAS TO BE USED ALONG WITH THE ANALYTICS SERVICE MOBIQO ⚠️

👉 CREATE AN ACCOUNT HERE: https://getmobiqo.com?utm_source=npm


The Mobiqo Flutter SDK allows you to integrate your Flutter application with the Mobiqo user intelligence platform. Track events, manage user data, and gain insights into user behavior.

Features #

  • User identification and session tracking
  • Custom event tracking
  • Automatic heartbeat for session management
  • Retrieval of user analytics and predictions

Getting Started #

Prerequisites #

  • Flutter version 1.17.0 or higher.
  • A Mobiqo account and API key.

Installation #

  1. Add this to your package's pubspec.yaml file:

    dependencies:
      mobiqo_flutter: ^0.0.6
    
  2. Install packages from the command line:

    flutter pub get
    

Usage #

Import the package:

import 'package:mobiqo_flutter/mobiqo_flutter.dart';

Initialize the Mobiqo:

final mobiqo = Mobiqo();

void main() async {
  // Important: Ensure Flutter bindings are initialized if you are calling init before runApp
  WidgetsFlutterBinding.ensureInitialized();

  await mobiqo.init(mobiqoKey: 'YOUR_MOBIqo_API_KEY');
  runApp(MyApp());
}

Sync a user:

try {
  SyncUserResponse? response = await mobiqo.syncUser(
    revenueCatUserId: 'your_user_id_from_revenuecat_or_internal_id',
    additionalData: {'plan': 'premium', 'email': 'user@example.com'},
  );
  if (response != null) {
    print('User synced: ${response.appUser.mobiqoUsername}');
    print('Purchase probability: ${response.statistics.purchaseProbability}');
  }
} catch (e) {
  print('Error syncing user: $e');
}

Track an event:

try {
  await mobiqo.trackEvent(
    'button_pressed',
    MobiqoEvent.click,
    additionalData: {'button_name': 'subscribe_now', 'page': 'homepage'},
  );
  print('Event tracked!');
} catch (e) {
  print('Error tracking event: $e');
}

Get user info:

try {
  GetUserInfoResponse? userInfo = await mobiqo.getUserInfo(
    revenueCatUserId: 'your_user_id_from_revenuecat_or_internal_id',
  );
  if (userInfo != null) {
    print('User OS: ${userInfo.appUser.os}');
  }
} catch (e) {
  print('Error getting user info: $e');
}

Dispose the service when no longer needed (e.g., in your main app widget's dispose method):

@override
void dispose() {
  mobiqo.dispose(); // Clean up heartbeat timer
  super.dispose();
}

Contributing #

Contributions are welcome! Please feel free to submit a pull request.

License #

This SDK is released under the MIT License. See the LICENSE file for details.

0
likes
0
points
21
downloads

Publisher

unverified uploader

Weekly Downloads

Mobiqo SDK for Flutter. Integrate with Mobiqo for user analytics, predictions, and insights.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, http, shared_preferences

More

Packages that depend on mobiqo_flutter