archethic_wallet_client 2.0.6 copy "archethic_wallet_client: ^2.0.6" to clipboard
archethic_wallet_client: ^2.0.6 copied to clipboard

A client dart library to interact with Archethic Wallet RPC API.

example/lib/main.dart

import 'package:archethic_wallet_client/archethic_wallet_client.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dapp_example/logger.dart';
import 'package:flutter_dapp_example/main_screen.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  LoggerSetup.instance().setup();
  runApp(const MyApp());
}

final _aewalletClient = ArchethicDAppClient.auto(
  origin: const RequestOrigin(
    name: 'FlutterDappExample',
  ),
  replyBaseUrl: 'flutterdappexample://dapp.example',
)..connect();

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Archethic Wallet Client Demo',
      home: Scaffold(
        body: MainScreen(aewalletClient: _aewalletClient),
      ),
      onGenerateRoute: (settings) {
        if ((_aewalletClient as DeeplinkArchethicDappClient)
            .handleRoute(settings.name)) return;
        return null;
      },
    );
  }
}