solana_wallet_adapter 0.0.2+1
solana_wallet_adapter: ^0.0.2+1 copied to clipboard
The Solana Dart API for the Mobile Wallet Adapter Specification.
Dart implementation of Solana's Mobile Wallet Adapter Specification protocol. The protocol exposes functionalities of Android and iOS wallet apps like Phantom and Solflare to dapps.

Screenshot of solana_wallet_provider
Non-privileged Methods #
Non-privileged methods do not require the current session to be in an authorized state to invoke them.
Privileged Methods #
Privileged methods require the current session to be in an authorized state to invoke them. For details on how a session enters and exits an authorized state, see the non-privileged methods.
Example: Authorize #
import 'package:flutter/material.dart';
import 'package:solana_wallet_adapter/solana_wallet_adapter.dart';
void main() {
runApp(const MaterialApp(
home: Scaffold(
body: Center(
child: AuthorizeButton(),
),
),
));
}
// 1. Create instance of [SolanaWalletAdapter].
final adapter = SolanaWalletAdapter(
const AppIdentity(),
cluster: Cluster.devnet,
);
class AuthorizeButton extends StatefulWidget {
const AuthorizeButton({super.key});
@override
State<AuthorizeButton> createState() => _AuthorizeButtonState();
}
class _AuthorizeButtonState extends State<AuthorizeButton> {
Object? _output;
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
onPressed: () {
// 2. Authorize application with wallet.
adapter.authorize()
.then((result) => setState(() => _output = result.toJson()))
.catchError((error) => setState(() => _output = error));
},
child: const Text('Authorize'),
),
if (_output != null)
Text(_output.toString()),
],
);
}
}
Bugs #
Report a bug by opening an issue.
Feature Requests #
Request a feature by raising a ticket.