flutter_blockchain 0.0.1

Flutter Android iOS

A new flutter plugin project.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:flutter_blockchain/flutter_blockchain.dart';
import 'package:flutter_blockchain/dcr.dart';

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

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

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  @override
  void initState() {
    super.initState();
    initPlatformState();

    () async {
         debugPrint(await DCR.randomMnemonic());
         var mnemonic = "助记词";

         // DCR.TESTNET  DCR的测试环境
         // DCR.MAINNET  DCR的正式环境
         // DCR.FISTNET  FIST的正式环境
         debugPrint(await DCR.address(mnemonic, DCR.FISTNET));


         // utxo = "txid,scriptPubKey,vout,amount"  
         // http://mainnet.fistchain.org/insight/api/addr/FsUEuuA7XFqSe67eRxBfoh4hxigMLgYWhNk/utxo    FIST的正式换
         // https://testnet.decred.org/insight/api/addr/FsUEuuA7XFqSe67eRxBfoh4hxigMLgYWhNk/utxo      DCT的测试环境
         debugPrint(await DCR.transfer(mnemonic, DCR.FISTNET, "FsdckjcFATawyvXd48DCvR6u2uewycZAQ83", 4, ["1ea27eec3d8621ae7e97b85f47c8e29f6a2f3b3f04c29c5c6a58ed7135747251,76a9146cfda5c1e7a1d028097808e317debaab66cb99e588ac,0,100"]));
  
    }();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      platformVersion = await FlutterBlockchain.platformVersion;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Running on: $_platformVersion\n'),
        ),
      ),
    );
  }
}
0
likes
70
pub points
0%
popularity

A new flutter plugin project.

Homepage

Documentation

API reference

Uploader

xusir92@gmail.com

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_blockchain