fyno_flutter_platform

A Dart package for communication with native platform code through method channels in Flutter applications developed by Fyno.

Installation

Add the following to your pubspec.yaml file:

dependencies:
  fyno_flutter_platform: ^1.0.2

Then run:

dart pub get

Usage

Import the package in your Dart file:

import 'package:fyno_flutter_platform/fyno_flutter_platform.dart';

Initializing the Platform

FynoPlatformRepository platformRepository = FynoPlatformRepository();

Exception? initResult = platformRepository.init(
  "your_workspace_id",
  "your_token",
  "your_user_id",
  "your_version",
);

if (initResult == null) {
  // Initialization successful
} else {
  // Handle initialization error
  print("Initialization error: $initResult");
}

Identifying the User

Exception? identifyResult = platformRepository.identify("your_user_id");

if (identifyResult == null) {
  // User identification successful
} else {
  // Handle identification error
  print("Identification error: $identifyResult");
}

Registering Push Notifications with Xiaomi Services

Exception? pushRegistrationResult = platformRepository.registerPush(
  "xiaomi_application_id",
  "xiaomi_application_key",
  "push_region",
  "integration_id",
);

if (pushRegistrationResult == null) {
  // Push registration successful
} else {
  // Handle push registration error
  print("Push registration error: $pushRegistrationResult");
}

Registering Push Notifications with Firebase Cloud Messaging (FCM)

Exception? fcmPushRegistrationResult =
    platformRepository.registerFCMPush("integration_id");

if (fcmPushRegistrationResult == null) {
  // FCM push registration successful
} else {
  // Handle FCM push registration error
  print("FCM push registration error: $fcmPushRegistrationResult");
}

Merging User Profiles

Exception? mergeResult = platformRepository.mergeProfile(
  "old_distinct_id",
  "new_distinct_id",
);

if (mergeResult == null) {
  // User profile merge successful
} else {
  // Handle user profile merge error
  print("User profile merge error: $mergeResult");
}

Updating User Status

Exception? updateStatusResult = platformRepository.updateStatus(
  "callback_url",
  "status",
  '{"key": "value"}',
);

if (updateStatusResult == null) {
  // User status update successful
} else {
  // Handle user status update error
  print("User status update error: $updateStatusResult");
}

Resetting User Information

Exception? resetUserResult = platformRepository.resetUser();

if (resetUserResult == null) {
  // User information reset successful
} else {
  // Handle user information reset error
  print("User information reset error: $resetUserResult");
}

License

This project is licensed under the 3-Clause BSD License - see the LICENSE file for details.