Ajit Raj
Ajit Raj

Reputation: 1

Flutterflow package plaid_flutter: ^3.1.4 throws error upon initializing PlaidLink with the correct LinkToken in Custom Action. What am I missing?

I am able to obtain the link token successfully from Plaid. However, when I pass it to the app (Tried in both Flutterflow Test mode from both desktop and mobile browsers) and trying to initialize the Plaid Link, it fails with the following error.

I masked the link-token for security purposes but I confirmed that the link-token is valid.

It is failing while opening PlaidLink funtion.

Has anyone tried this package before in Flutterflow and shed some light on what I could be missing?

Custom Action Code:

import 'package:plaid_flutter/plaid_flutter.dart';

Future initPlaidLink() async {
  // Add your function code here!
  print('Initializing Plaid Link');

  LinkConfiguration configuration = LinkTokenConfiguration(
    token: "link-sandbox-xxxxxxxxxxxxxxxxxxxxx",
  );

  PlaidLink.open(configuration: configuration);
}

Error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'create')
    at plaid_flutter_web.PlaidFlutterPlugin.new.open (plaid_flutter_web.dart:97:20)
    at open.next (<anonymous>)
    at runBody (dart_sdk.js:39921:34)
    at Object._async [as async] (dart_sdk.js:39957:7)
    at plaid_flutter_web.PlaidFlutterPlugin.new.open (plaid_flutter_web.dart:35:20)
    at open (plaid_link.dart:36:21)
    at open.next (<anonymous>)
    at runBody (dart_sdk.js:39921:34)
    at Object._async [as async] (dart_sdk.js:39957:7)
    at PlaidLink.open (plaid_link.dart:35:27)
    at initPlaidLink (init_plaid_link.dart:32:13)
    at initPlaidLink.next (<anonymous>)
    at runBody (dart_sdk.js:39921:34)
    at Object._async [as async] (dart_sdk.js:39957:7)
    at Object.initPlaidLink (init_plaid_link.dart:13:21)
    at page7_add_account_widget.dart:33:21
    at Generator.next (<anonymous>)
    at runBody (dart_sdk.js:39921:34)
    at Object._async [as async] (dart_sdk.js:39957:7)
    at page7_add_account_widget.dart:32:53
    at [_invokeFrameCallback] (binding.dart:1297:15)
    at binding$5.WidgetsFlutterBinding.new.handleDrawFrame (binding.dart:1236:9)
    at [_handleDrawFrame] (binding.dart:1085:5)
    at Object.invoke (dart_sdk.js:193938:7)
    at _engine.EnginePlatformDispatcher.new.invokeOnDrawFrame (dart_sdk.js:168021:15)
    at dart_sdk.js:193679:57
    at Object._checkAndCall (dart_sdk.js:5625:16)
    at Object.dcall (dart_sdk.js:5630:17)
    at ret (dart_sdk.js:61495:21)

After adding the recommended js link to index.html file under web dir, I get the this error (click to see attached screenshot).

Upvotes: 0

Views: 280

Answers (1)

Alex
Alex

Reputation: 1853

Can you confirm you have <script src="https://cdn.plaid.com/link/v2/stable/link-initialize.js"></script>in the index.html file? Per https://github.com/jorgefspereira/plaid_flutter/issues/111, not having that line can cause this issue.

Upvotes: 0

Related Questions