Installation

Flutter Inform SDK Wrapper

Creating a Flutter project using the ValidicMobile plugin involves the following steps.

  1. To use the validic_core package, add it to your pubspec.yaml file:
dependencies:
  validic_core:
    hosted:
      name: validic_core
      url: https://validic.jfrog.io/artifactory/api/pub/mobile-pub
    version: ^2.0.0
  1. Then, import the package in your Dart code:
import 'package:validic_core/validic_core.dart';

These code examples add the Session (validic_core) module to your project.




Example Usage

Create a Validic User

final ValidicUser validicUser = ValidicUser(
  userID: 'VALIDIC_USER_ID',
  organizationID: 'ORGANIZATION_ID',
  accessToken: 'ACCESS_TOKEN',
);

Starting a Session

void startValidicSession() async {
  await ValidicCore.startSession(validicUser);
}

Ending a Session

void endValidicSession() async {
  await ValidicCore.endSession();
}

Submitting a Record

void submitRecord() async {
  final InformRecord record = InformRecord(
    // Initialize the record with appropriate values
  );
  await ValidicCore.submitRecord(record);
}

Listening to events

void listenToEvents() {
  ValidicCore.onSessionEnd.listen((event) {
    print('Session ended: ${event.userID} with ${event.informRecords.length} unsent Records');
  });

  ValidicCore.onRecordSubmit.listen((event) {
    print('Record submitted: ${event.informRecord}');
  });

  ValidicCore.onRecordSubmitError.listen((event) {
    print('Record submission error: ${event.error}');
  });
}