This solution will guide you in developing and deploying a cross-platform wallet application using the Algorand blockchain features that addresses the following use case:
Building a cross-platform Algorand wallet that can export to mobile, web and desktop with Dart & Flutter
The solution architecture relies on the recently released community SDK, algorand-dart, Bloc, a predictable state management library and Hive, a lightweight and blazing fast key-value database written in pure Dart. This solution focuses on developers who want to build cross-platform applications with a write once, run anywhere approach. The sample app shows some example code on how to create and build a cross-platform Flutter application and connect it to the Algorand blockchain with the algorand-dart SDK and is currently a work in progress.
- Android Studio (or another Flutter-supported IDE)
- Flutter 2.0 (>=) - stable channel
- (Optional) A PureStake Account and the corresponding API key OR a locally hosted node
If it’s your first time working with Flutter, I recommend you to go through the Getting Started section of the Flutter documentation to learn more about the different features and installation methods Flutter has to offer.
Ensure you have the latest stable channel of the Flutter SDK (>= 2.0), Dart 2.12.1 (>=) and the latest version of the algorand-dart SDK.
Once installed, make sure to enable web and desktop support if you wish to export to those modules.
Go to the sample app's github and download/clone the repository. Open Android Studio, select Open an Existing project and navigate to the cloned project.
Run the following commands to use the latest version of the Flutter SDK:
flutter channel stable
flutter pub get
If Chrome is installed, the flutter devices
command outputs a Chrome device that opens the Chrome browser with your app running, and a Web Server that provides the URL serving the app.
Open up service_locator.dart
and inspect how the Algorand client is set up.
When everything is set up, select your target platform and click run!
Troubleshoot
First of all, run flutter doctor
to check which tools are installed on the local machine and which tools need to be configured. Make sure all of them are checked and enabled.
If you have some issues running the sample project, make sure Flutter is enabled and active:
- Open plugin preferences (File > Settings > Plugins).
- Select Marketplace, select the Flutter plugin and click Install.
- Restart the IDE
After restarting and indexing the IDE, open main.dart
and run flutter pub get
to fetch the dependencies.
Then the option to run main.dart
should be available and the different export options to emulator, Edge or chrome should be visible.
You don’t need to change the run/debug configurations - the Flutter plugin takes care of that.
Also make sure the flutter SDK path is correctly filled in:
- Open Language & Framework preferences (File > Settings > Languages & Frameworks).
- Open Flutter and enter the Flutter SDK Path.