moveme_wallet 0.2.0
moveme_wallet: ^0.2.0 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();
}
}