Stellar SDK for Flutter Installation Guide
- Add the dependency to your pubspec.yaml file:
dependencies:
stellar_flutter_sdk: ^0.8.0
- Install it (command line or IDE):
flutter pub get
- In your source file import the SDK, initialize and use it:
import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart';
final StellarSDK sdk = StellarSDK.TESTNET;
String accountId = "GASYKQXV47TPTB6HKXWZNB6IRVPMTQ6M6B27IM5L2LYMNYBX2O53YJAL";
AccountResponse account = await sdk.accounts.account(accountId);
print("sequence number: ${account.sequenceNumber}");
Add the SDK is a Flutter Dart plugin. Here is a step by step that we recommend:
- Clone this repo.
- Open the project in your IDE (e.g. Android Studio).
- Open the file
pubspec.yaml
and pressPub get
in your IDE. - Go to the project's
test
directory, run a test from there and you are good to go!
Add it to your app:
- In your Flutter app add the local dependency in
pubspec.yaml
and then runpub get
:
dependencies:
flutter:
sdk: flutter
stellar_flutter_sdk:
path: ../stellar_flutter_sdk
- In your source file import the SDK, initialize and use it:
import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart';
final StellarSDK sdk = StellarSDK.TESTNET;
String accountId = "GASYKQXV47TPTB6HKXWZNB6IRVPMTQ6M6B27IM5L2LYMNYBX2O53YJAL";
AccountResponse account = await sdk.accounts.account(accountId);
print("sequence number: ${account.sequenceNumber}");
To continue learning about the sdk, please have a look to our Quick start guide