transfi_on_ramp_flutter_sdk 0.0.2 copy "transfi_on_ramp_flutter_sdk: ^0.0.2" to clipboard
transfi_on_ramp_flutter_sdk: ^0.0.2 copied to clipboard

A Flutter plugin to connect your application with transfi.

Flutter Transfi WebView Plugin #

Plugin that allows Flutter to communicate with a native WebView.

Getting Started #

For help getting started with Flutter, view our online documentation.

iOS

In order for plugin to work correctly, you need to add new key to ios/Runner/Info.plist

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
</dict>

NSAllowsArbitraryLoadsInWebContent is for iOS 10+ and NSAllowsArbitraryLoads for iOS 9.

How it works #

Launch WebView with Flutter

class _MyAppState extends State<MyApp> {
  String _transactionStatus= '';
  final _transfiConnectPlugin = TransfiConnect();

  @override
  void initState() {
    super.initState();
  }

  Future<void> closeWebView() async {
    await _transfiConnectPlugin.closeWebView();
  }

  Future<void> openWebView() async {
   String status;
   const String url = "https://buy.transfi.com/?apiKey=[YOUR_API_KEY]";
    try {
      status =
          await _transfiConnectPlugin.openWebView(url) ?? 'Unknown';
          switch(status){
            case "success":
            //handle success
            break;
            case "error":
            //handle error
            break;
            default:
            //handle error
            break;
          }

    } on PlatformException {
      status = 'Something went wrong';
    }
    if (!mounted) return;
    setState(() {
      _transactionStatus = status;
    });
  }

 @override
 Widget build(BuildContext context) {
   return
     MaterialApp(
      home: Scaffold(
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              ElevatedButton(
                onPressed: openWebView,
                child: const Text('Open transfi'),
              ),
              Text(_transactionStatus),
            ],
          ),
        ),
      ),
    );
  }
}

transfi-on-ramp-flutter-sdk #

0
likes
110
points
1
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin to connect your application with transfi.

Documentation

API reference

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on transfi_on_ramp_flutter_sdk

Packages that implement transfi_on_ramp_flutter_sdk