proba_sdk_flutter

Mobile framework for Proba platform.

Installation

  1. Add this to your package's pubspec.yaml file:
    dependencies:
      proba_sdk_flutter:
  1. Now in your Dart code, you can use:
    import 'package:proba_sdk_flutter/proba_sdk_flutter.dart';

Usage

Initialization:

    await Proba.initialize(
      appId: "${YOUR_APP_ID}",
      sdkToken: "${YOUR_SDK_TOKEN}",
      deviceId: "${YOUR_DEVICE_ID}" // optional, UUID generated by default
      appsFlyerId: "${YOUR_APPS_FLYER_UID}" // optional
      amplitudeUserId: "${YOUR_AMPLITUDE_USER_ID}" // optional, if Amplitude integration is needed
      defaults: {"${TEST_1_KEY}": "${TEST_1_DEFAULT_VALUE}", "${TEST_2_KEY}": "${TEST_2_DEFAULT_VALUE}"},
      deviceProperties: {"installedAt": "2021-05-20T09:55:05.000+03:00"}, // optional, additional information about device
    );

After initialization all functionality will be available via singleton:

    Proba.instance()

How to fetch known test values that associated with your device?

    Proba.instance()!.loadExperiments((List<String> experimentsKeys) {
        // Handle loaded experiments
    });

How to get the value for a specific test?

    final value = Proba.instance()!.experiment("${TEST_KEY}");

In case of problems with no internet connection or another, the values obtained in the previous session will be used, or if they are missing, the default values specified during initialization will be used.

How to get user tests for analytics?

    final value = Proba.instance()!.experiments;
    
    // or if you need additional details for experiments
    final value = Proba.instance()!.experimentsWithDetails;

How to debug?

Before debug make sure that debug-mode for your App is turned-on on settings page

In debug mode you can see all actual tests and check how the user will see each option of the test. To show the debug bottom sheet you just need to turn it on in your personal cabinet and call

    Proba.instance()!.showDebugLayer(
      context: context,
      valuesChangedCallback: (List<String> changedExperimentsKeys) {
        // Handle changed experiments
      },
    );

You can enable showing debug bottom sheet by performing shake motion on your device:

    Proba.instance()!.enableDebugOnShake(
      context: context,
      valuesChangedCallback: (List<String> changedExperimentsKeys) {
        // Handle changed experiments
      },
    );

or disable this behavior:

    Proba.instance()!.disableDebugOnShake();

Libraries

proba_sdk_flutter