Skip to content

Noodle-Cx/phyllo-connect-flutter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phyllo_connect

pub package

Phyllo Connect is a quick and secure way to connect work platforms via Phyllo in your app. Supports: iOS, Android.

Usage

To use this plugin, add phyllo_connect as a dependency in your pubspec.yaml file.

Example

Replace your

import 'package:phyllo_connect/phyllo_connect.dart';

class Configs {
  Configs._();

  static const String clientId = '<client id here>';

  static const String clientSecret = '<client secret here>';

  static const PhylloEnvironment environment = PhylloEnvironment.sandbox; //set phyllo environment
}

-> Lib -> phyllo_provider.dart

import 'package:flutter/material.dart';
import 'package:phyllo_connect/phyllo_connect.dart';
import 'package:phyllo_connect_example/client/phyllo_repository.dart';
import 'package:phyllo_connect_example/constants/configs.dart';

final PhylloConnect _phylloConnect = PhylloConnect.instance;
//Too Lunch the sdk here it will method
void _launchSdk(String workPlatformId) {

  Map<String, dynamic> config = {
      'clientDisplayName': clientDisplayName,
      'environment': PhylloEnvironment.sandbox.name,
      'userId': _userId!,
      'token': _token!,
      'workPlatformId': workPlatformId
    };

    _phylloConnect.initialize(config);
    _phylloConnect.open();
    
    //Call Back from Android/iOS SDK
    _phylloConnect.onConnectCallback(
        onAccountConnected: (account_id, work_platform_id, user_id) {
      log('onAccountConnected: $account_id, $work_platform_id, $user_id');
    }, onAccountDisconnected: (account_id, work_platform_id, user_id) {
      log('onAccountDisconnected: $account_id, $work_platform_id, $user_id');
    }, onTokenExpired: (user_id) {
      log('onTokenExpired: $user_id');
    }, onExit: (reason, user_id) {
      log('onExit: $reason, $user_id');
    },
     // [Optional callback] onConnectionFailure : User can now add a new callback connectionFailure for tracking the reason of accounts not getting connected.
        onConnectionFailure: (reason, work_platform_id, user_id) {
      log('onConnectionFailure: $reason, $work_platform_id, $user_id');
    );

    log('version: ${_phylloConnect.version()}');
    
  }

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 60.2%
  • Kotlin 16.3%
  • Swift 15.9%
  • Ruby 5.9%
  • Objective-C 1.7%