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

outdated

A reference implementation of the Mobile Wallet Adapter specification for Flutter.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:solana_mobile_wallet_example/mobile_wallet/bloc.dart';
import 'package:solana_mobile_wallet_example/screens/auth_screen.dart';
import 'package:solana_mobile_wallet_example/screens/send_transactions_screen.dart';
import 'package:solana_mobile_wallet_example/screens/sign_payloads_screen.dart';
import 'package:solana_mobile_wallet_example/screens/sign_transactions_for_sending.dart';

void main() {
  runApp(
    BlocProvider(
      create: (_) => MobileWalletBloc(),
      child: const MyApp(),
    ),
  );
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) => MaterialApp(
        home: Scaffold(
          appBar: AppBar(
            title: const Text('Plugin example app'),
          ),
          body: BlocConsumer<MobileWalletBloc, MobileWalletState>(
            listener: (context, state) => state.whenOrNull(
              sessionTerminated: SystemNavigator.pop,
            ),
            builder: (context, state) => state.when(
              none: () => const Center(
                child: Text('Running...'),
              ),
              sessionTerminated: () => const Center(
                child: Text('Running...'),
              ),
              remote: (r) => r.map(
                authorizeDapp: (r) => AuthScreen(request: r.request),
                signPayloads: (r) => SignPayloadsScreen(request: r.request),
                signTransactionsForSending: (r) =>
                    SignTransactionsForSendingScreen(request: r.request),
                sendTransactions: (r) => SendTransactionsScreen(request: r),
              ),
            ),
          ),
        ),
      );
}
0
likes
0
pub points
44%
popularity

Publisher

verified publishercryptoplease.com

A reference implementation of the Mobile Wallet Adapter specification for Flutter.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, freezed_annotation, json_annotation, plugin_platform_interface

More

Packages that depend on solana_mobile_wallet