-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Body:
Environment
- FlutterFlow project
phyllo_connectversion: 0.3.5
Description
I'm trying to integrate the phyllo_connect plugin into a FlutterFlow project, but I'm encountering a MissingPluginException. I have followed the steps to add the plugin as per the example provided on pub.dev but have been unable to resolve this issue due to the limitations within FlutterFlow's environment.
Steps to Reproduce
- Added
phyllo_connectto the pubspec dependencies via FlutterFlow's UI. - Tried to utilize the plugin in a custom action.
- Encountered the
MissingPluginException.
Expected Behavior
The plugin should be recognized, and no MissingPluginException should occur after adding it through the FlutterFlow UI.
Actual Behavior
The plugin is causing a MissingPluginException, indicating that it is not properly linked or recognized by the FlutterFlow environment.
Additional Information
Here is the example code I'm trying to use in FlutterFlow, adapted from the plugin's example on pub.dev:
// Automatic FlutterFlow imports
import '/backend/supabase/supabase.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
// Additional imports for Phyllo Connect and logging
import 'package:phyllo_connect/phyllo_connect.dart';
import 'dart:async';
import 'dart:developer' as developer;
Future<String> connectWithInstagramFlutter(BuildContext context) async {
// Assuming these values are retrieved securely from your server/environment
final String clientId = '------------------';
final String clientSecret = '------------------';
// The user ID and token should be dynamically obtained from your backend
final String userId = '------------------';
final String sdkToken = '------------------';
final _phylloConnect = PhylloConnect.instance;
Map<String, dynamic> config = {
'clientDisplayName': 'Vedanta tech',
'environment': 'sandbox', // Change to 'production' as needed
'userId': userId,
'token': sdkToken,
'workPlatformId':
'------------------', // Replace with actual Instagram ID from Phyllo
};
String result = "Initialization Failed";
try {
_phylloConnect.initialize(config);
_phylloConnect.open();
// Setup callback listeners
_phylloConnect.onConnectCallback(
onAccountConnected: (accountId, workPlatformId, userId) {
developer
.log('onAccountConnected: $accountId, $workPlatformId, $userId');
result = "Success: Connected with account ID: $accountId";
},
onAccountDisconnected: (accountId, workPlatformId, userId) {
developer
.log('onAccountDisconnected: $accountId, $workPlatformId, $userId');
result = "Disconnected: Account ID: $accountId";
},
onTokenExpired: (userId) {
developer.log('onTokenExpired: $userId');
result = "Error: Token expired for user ID: $userId";
},
onExit: (reason, userId) {
developer.log('onExit: $reason, $userId');
result = "User exited: $reason";
},
onConnectionFailure: (reason, workPlatformId, userId) {
developer.log('onConnectionFailure: $reason, $workPlatformId, $userId');
result = "Connection Failure: $reason";
},
);
} catch (error) {
developer.log('Error initializing Phyllo Connect: $error');
result = "Error initializing Phyllo Connect: $error";
}
return result;
}
Given the constraints within FlutterFlow (e.g., inability to run flutter clean, flutter pub get, or restart the IDE), I am limited in what troubleshooting steps I can take. Any guidance or assistance on resolving this issue would be greatly appreciated.
@erpankajpatel @mohitkmr07 @chiragphyllo
Could you please look into this? If there are any additional steps needed to ensure compatibility with FlutterFlow, that information would be very helpful.
Thank you for your time and assistance.
