mesh_sdk_flutter 0.0.1 copy "mesh_sdk_flutter: ^0.0.1" to clipboard
mesh_sdk_flutter: ^0.0.1 copied to clipboard

Flutter library for integrating with Mesh Connect.

Flutter package for integrating with Mesh Connect.

Requirements #

  • Dart >= 3.9.2
  • Flutter >= 3.35.7

Getting started #

To use the Mesh SDK in your Flutter application, add the following dependency to your pubspec.yaml file:

dependencies:
  mesh_sdk_flutter: <latest_version>

Localization #

Mesh SDK uses the flutter_localizations package for localization.

For it to work, you need to add MeshLocalizations.localizationsDelegates to your MaterialApp.localizationsDelegates, like so:

import 'package:mesh_sdk_flutter/mesh_sdk_flutter.dart';

@override
Widget build(BuildContext context) {
  return MaterialApp(
    localizationsDelegates: [
      ...
      MeshLocalizations.localizationsDelegates,
    ],
    
  );
}

Link token should be obtained from the POST /api/v1/linktoken endpoint. API reference for this request is available here. The request must be performed from the server side because it requires the client's secret. You will get the response in the following format:

{
  "content": {
    "linkToken": "{linkToken}"
  },
  "status": "ok",
  "message": ""
}

Usage #

Future<void> _showMeshLinkPage(String linkToken) async {
  final result = await MeshSdk.show(
    context,
    configuration: MeshConfiguration(
      language: 'en',
      integrationAccessTokens: const [
        IntegrationAccessToken(
          accessToken: 'token',
          accountId: 'id',
          accountName: 'name',
          brokerName: 'broker',
          brokerType: 'type',
        ),
      ],
      linkToken: linkToken,
      onEvent: (event) {
        print('Mesh event: $event');
      },
      onExit: (errorType) {
        print('Mesh exit: $errorType');
      },
      onIntegrationConnected: (integration) {
        print('Integration connected: $integration');
      },
      onTransferFinished: (transfer) {
        print('Transfer finished: $transfer');
      },
    ),
  );

  switch (result) {
    case MeshSuccess():
      print('Mesh link finished successfully');
    case MeshError():
      print('Mesh link error: ${result.type}');
  }
}

See full example app here.

Configuration #

Here's what you can configure in the MeshConfiguration:

Parameter Type Required description
linkToken String Link token obtained from the backend.
language String Language, defaults to "en".
isDomainWhitelistEnabled bool If domain should be checked against our whitelist. Defaults to true.
integrationAccessTokens List<IntegrationAccessToken> List of cached IntegrationAccessTokens that you can pass, so users don't need to connect every time.
onError ValueChanged<MeshErrorType>? Error callback with a MeshErrorType that describes the error.
onSuccess ValueChanged<MeshSuccess>? Success callback with SuccessPayload that contains more info about the transfer or integration.
onEvent ValueChanged<MeshEvent>? Callback for when an event is triggered.
onIntegrationConnected ValueChanged<IntegrationConnectedEvent>? Callback for when an integration is connected. Use this to store the access token.
onTransferFinished ValueChanged<TransferFinishedEvent>? Callback for when a crypto transfer is executed.

Whitelist #

See the full list of whitelisted origins here.

To disable the whitelist check, set isDomainWhitelistEnabled: false in the MeshConfiguration.

1
likes
150
points
121
downloads

Publisher

verified publishermeshpay.com

Weekly Downloads

Flutter library for integrating with Mesh Connect.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

collection, flutter, flutter_localizations, intl, logging, package_info_plus, url_launcher, webview_flutter

More

Packages that depend on mesh_sdk_flutter