vivanta_connect_flutter 0.5.3+9 copy "vivanta_connect_flutter: ^0.5.3+9" to clipboard
vivanta_connect_flutter: ^0.5.3+9 copied to clipboard

Vivanta Connect for Flutter

Vivanta Connect for Flutter #

Plugin to integrate Vivanta Connect in Flutter Projects

How to implement Vivanta Connect Flow #

  1. Add the import of Vivanta Connect
import 'package:vivanta_connect_flutter/views/start_vivanta_connect.dart';
  1. Create a route to open Vivanta Connect. For example:
 Navigator.of(context).push(
  MaterialPageRoute(
    builder: (context) => VivantaConnectFlutter(
      apiKey: apiKey,                   // Required
      customerId: customerId,           // Required
      externalUserId: externalUserId,   // Required
      companyId: companyId,             // Optional
    ),
  ),
);
  1. Vivanta Connect will start and automatically set the language based on the configuration of the device.

Note: Vivanta Connect requires a valid API Key and the associated Customer ID to fully function.

How to implement Embedded Graphs #

  1. Create a route to open an Embedded Graph
Navigator.of(context).push(
  MaterialPageRoute(
    builder: (context) => EmbeddedGraph(
      apiKey: apiKey,                    // Required
      customerId: customerId,            // Required
      externalUserId: externalUserId,    // Required
      graphType: graphType,              // Required (Sleep, Active Time, Activity)
      brandId: brandId,                  // Optional, only for users with more than 1 brand connected
    ),
  ),
);

Only for Apple Health integrations #

  1. You must add this code at the start of your user's session for obtaining and syncing Apple Health data.
  import 'package:vivanta_connect_flutter/helpers/vivanta_sync.dart';

  final vivantaSyncData = VivantaSync(
    apiKey: apiKey,                   // Required
    customerId: customerId,           // Required
    externalUserId: externalUserId,   // Required
  );
  vivantaSyncData.executeAll();       // This process gets data from HealthKit and uploads to Vivanta
);
  1. You must add the following elements in the Info.plist file.
<key>NSHealthShareUsageDescription</key>
<string>[Add here the purpose for reading from Apple Health]</string>
<key>NSHealthUpdateUsageDescription</key>
<string>[Add here the purpose for writing to Apple Health]</string>