moveme_wallet 0.2.5 copy "moveme_wallet: ^0.2.5" to clipboard
moveme_wallet: ^0.2.5 copied to clipboard

SDK Flutter/Dart for MoveMe Digital Wallet (safe client + server payments entry).

example/main.dart

import 'dart:io';

import 'package:moveme_wallet/moveme_wallet.dart';

Future<void> main() async {
  final apiKey = Platform.environment['WALLET_API_KEY'] ??
      Platform.environment['API_KEY'];
  final baseUrl = Platform.environment['WALLET_BASE_URL'] ??
      Platform.environment['BASE_URL'];
  if (apiKey == null ||
      apiKey.isEmpty ||
      baseUrl == null ||
      baseUrl.isEmpty) {
    stderr.writeln('Defina WALLET_BASE_URL e WALLET_API_KEY.');
    exitCode = 1;
    return;
  }

  final externalUserId =
      Platform.environment['EXTERNAL_USER_ID'] ?? 'moveme:sdk_example';

  final wallet = WalletClient(
    options: WalletClientOptions(baseUrl: baseUrl, apiKey: apiKey),
  );

  try {
    await wallet.health();
    final account = await wallet.ensureAccount(externalUserId);
    final balance = await wallet.getBalance(account.id);
    stdout.writeln('balance: ${balance.balance} ${balance.currency}');
  } on WalletApiError catch (e) {
    stderr.writeln(e);
    exitCode = 1;
  } finally {
    wallet.close();
  }
}
0
likes
0
points
198
downloads

Publisher

unverified uploader

Weekly Downloads

SDK Flutter/Dart for MoveMe Digital Wallet (safe client + server payments entry).

Repository (GitHub)
View/report issues

Topics

#wallet #payments #sdk #flutter

License

unknown (license)

Dependencies

crypto, http, meta

More

Packages that depend on moveme_wallet