stellarplugin 0.0.3+12

  • Readme
  • Changelog
  • Example
  • Installing
  • 44

stellarplugin #

Flutter Stellar Plugin #

Description and Example Usage #

This Flutter plugin enables development of Android, iOS, macOS, web and Windows applications that need to interact with Stellar. The plugin provides access to all the operations that are exposed by the official Stellar SDK's. The initial version of the Flutter plugin is derived from the Java version of the SDK and the first release of the plugin supports Android development. iOS, macOS, web and Windows development will follow in due course and as the Flutter ecosystem evolves to fully support a single code base for all these environments.

import 'package:stellarplugin/data_models/account_response_bag.dart';
import 'package:stellarplugin/data_models/payment_response.dart';
import 'package:stellarplugin/stellarplugin.dart';

AccountResponseBag accountResponseBag = await Stellar.createAccount(isDevelopmentStatus: true);

PaymentOperationResponse response = await Stellar.sendPayment(
          seed: seed,
          destinationAccount: destinationAccount,
          amount: amount,
          memo: memo,
          isDevelopmentStatus: true);

List<PaymentOperationResponse> paymentsReceived = await Stellar.getPaymentsReceived(
          seed: "secretSeed here");

List<PaymentOperationResponse> paymentsMade = await Stellar.getPaymentsMade(
          seed: "secretSeed here");

 AccountResponse acct = await Stellar.getAccount(
          seed: "secretSeed here");

isDevelopmentStatus is a boolean flag to help the plugin connect to either the Testnet and the public Stellar network. This code creates Stellar accounts and , if isDevelopmentStatus is true FriendBot is politely asked for 10,000 test XLM (lumens). Please take a look at the code that exercises most of the Stellar transaction operations listed below. The example code lives at https://github.com/malengatiger/stellar-flutter-plugin-repo/tree/master/stellarplugin/example

Stellar Transaction Operations supported: #

  • CreateAccount
  • SendPayment
  • GetPaymentsMade
  • GetPaymentsReceived
  • GetAccount
  • SetOptions
  • ManageBuyOffer
  • ManageSellOffer
  • CreatePassiveOffer
  • AllowTrust
  • ChangeTrust
  • MergeAccounts
  • BumpSequence
  • ManageData

Open Source Code #

Code for the plugin and the example app can be found here: https://github.com/malengatiger/stellar-flutter-plugin-repo

Flutter #

More information about Flutter can be found here: https://flutter.dev/

Screenshots from the example Flutter app #

This app is merely designed to exercise all the Stellar transaction operations available in the official SDK's. To get going, start by creating at least 2 accounts. Just tap around the UI provided and the app will make the appropriate calls to the Stellar Testnet. Scroll to the bottom of the screen to see logs of the actions taken during your use of the example app.

Screenshot 1 : Main Page of Example Flutter app #

Screenshot 1: Main Page of Example Flutter app

Screenshot 2: Main Page Scrolled to bottom for logs #

Screenshot 2: Main Page Scrolled to bottom

Screenshot 3: Account Page of Example Flutter app #

Screenshot 3: Account Page of Example Flutter app

0.0.1 #

  • TODO: Describe initial release.

0.0.2 #

0.0.3 #

  • Added screenshots from example app

0.0.3+1 #

  • Fixed broken screenshot links

0.0.3+2 #

  • Fixed broken screenshot links (again!)

0.0.3+3 #

  • Refactored example app

0.0.3+4 #

  • Removed extra logging

0.0.3+5 #

  • Removed asyncTask references

0.0.3+6 #

  • Refactored payment response handling

0.0.3+7 #

  • Refactored payment logging

0.0.3+8 #

  • Refactored account response model

0.0.3+9 #

  • Removed account response definition

0.0.3+10 #

  • Refactored Stellar connection code

0.0.3+11 #

  • Removed unnecessary account response fields

0.0.3+12 #

  • Removed more account response fields

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:stellarplugin_example/home.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primaryColor: Colors.pink,
      ),
      home: Home(),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  stellarplugin: ^0.0.3+12

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:stellarplugin/stellarplugin.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
44
Learn more about scoring.

We analyzed this package on Jul 12, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:stellarplugin/stellarplugin.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

  • package:stellarplugin/stellarplugin.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:stellarplugin/stellarplugin.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:stellarplugin/stellarplugin.dart that declares support for platforms: android, ios

Package not compatible with SDK dart

Because:

  • stellarplugin that is a package requiring null.

Health issues and suggestions

Document public APIs. (-1 points)

268 out of 268 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test