- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经导入了一个 Eosdart 包,它有 action.dart 文件,甚至 flutter 也有 action.dart 文件,所以应该选择哪个有冲突。
请帮助消除冲突
我在代码中的注释中提到了错误详细信息,其中出现了错误
class _AddBorrowerState extends State<AddBorrower> {
eos.Account _account;
eos.EOSClient _eosClient = eos.EOSClient(
'http://jungle2.cryptolions.io:80', 'v1',
privateKeys: ["5JfVW2PtRkAcLbLETevxCwaQuT8NNWvP2eBYCrPRKPBWDgZDEo1"]);
List<eos.Authorization> auth = [
eos.Authorization()
..actor = 'guru11111111'
..permission = 'active'
];
Map data = {
'acc_name': myController1.text,**error only static member can be accessed in initializers**
'b_id': '119',
'location': 'mumbai',
'b_phone': '11231212',
};
List<eos.Action> actions = [
eos.Action()
..account = 'guru11111111'
..name = 'addborrower'
..authorization = auth **ERROR only static member can be accessed in initializers**
..data = data**error only static member can be accessed in initializers**
];
eos.Transaction transaction = eos.Transaction()..actions = actions;
void _fetchEOSAccount() {
_eosClient.getAccount(myController2.text).then((eos.Account account) {
setState(() {
_account = account;
});
});
}
void add() {
_eosClient.pushTransaction(transaction, broadcast: true).then((trx) {
print(trx);
});
}
final myController1 = TextEditingController();
final myController2 = TextEditingController();
final myController3 = TextEditingController();
final myController4 = TextEditingController();
final myController5 = TextEditingController();
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.teal,
body: SafeArea(
child: Column(
children: <Widget>[
Card(
color: Colors.white,
margin: EdgeInsets.symmetric(vertical: 10, horizontal: 25),
child: TextField(**//these are textfeild who's value we want to store in eos table **
controller: myController1,
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Enter Full Name',
),
),
),
Card(
color: Colors.white,
margin: EdgeInsets.symmetric(vertical: 10, horizontal: 25),
child: TextField(
controller: myController2,
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Enter ID',
),
),
),
Card(
color: Colors.white,
child: FlatButton(
child: Text('Submit'),
onPressed: () {
// Navigator.pop(context);
_fetchEOSAccount();
},
),
),
Flexible(
child: Text('${_account?.toJson()}'),
),
],
),
),
),
);
}
}
最佳答案
编辑
初始化时 myController1.text 没有值
您可以使用空字符串并在以后的 Action 中更新此值
用
import 'package:eosdart/eosdart.dart' as eos;
eos.EOSClient(...)
import 'package:flutter/material.dart';
import 'package:eosdart/eosdart.dart' as eos;
import 'package:flutter/foundation.dart';
void main() {
eos.EOSClient client = eos.EOSClient('http://127.0.0.1:8888', 'v1',
privateKeys: ["5J9b3xMkbvcT6gYv2EpQ8FD4ZBjgypuNKwE1jxkd7Wd1DYzhk88"]);
List<eos.Authorization> auth = [
eos.Authorization()
..actor = 'bob'
..permission = 'active'
];
Map data = {
'from': 'bob',
'to': 'alice',
'quantity': '0.0001 SYS',
'memo': '',
};
List<eos.Action> actions = [
eos.Action()
..account = 'eosio.token'
..name = 'transfer'
..authorization = auth
..data = data
];
eos.Transaction transaction = eos.Transaction()..actions = actions;
// will print something like:
// {transaction_id: c28bf8c168741adb96f3aef8723e953140cc60ecd20cec0d22e5a2dc5cdd5571, processed: {id: c28bf8c168741adb96f3aef8723e953140cc60ecd20cec0d22e5a2dc5cdd5571, block_num: 576745, block_time: 2019-05-03T06:07:54.500, producer_block_id: null, receipt: {status: executed, cpu_usage_us: 216, net_usage_words: 16}, elapsed: 216, net_usage: 128, scheduled: false, action_traces: [{receipt: {receiver: eosio.token, act_digest: 117d5840be4ff21fad764d5d497182916f76e772b279e65e964bccfa7c888331, global_sequence: 576794, recv_sequence: 17, auth_sequence: [[bob, 37]], code_sequence: 1, abi_sequence: 1}, act: {account: eosio.token, name: transfer, authorization: [{actor: bob, permission: active}], data: {from: bob, to: alice, quantity: 0.0001 SYS, memo: }, hex_data: 0000000000000e3d0000000000855c340100000000000000045359530000000000}, context_free: false, elapsed: 73, console: , trx_id: c28bf8c168741adb96f3aef8723e953140cc60ecd20cec0d22e5a2dc5cdd5571, block_num: 576745, block_time: 2019-05-03T06:07:54.500, producer_block_id: null, account_ram_deltas: [], except: null, inline_traces: [{receipt: {receiver: bob, act_digest: 117d5840be4ff21fad764d5d497182916f76e772b279e65e964bccfa7c888331, global_sequence: 576795, recv_sequence: 14, auth_sequence: [[bob, 38]], code_sequence: 1, abi_sequence: 1}, act: {account: eosio.token, name: transfer, authorization: [{actor: bob, permission: active}], data: {from: bob, to: alice, quantity: 0.0001 SYS, memo: }, hex_data: 0000000000000e3d0000000000855c340100000000000000045359530000000000}, context_free: false, elapsed: 2, console: , trx_id: c28bf8c168741adb96f3aef8723e953140cc60ecd20cec0d22e5a2dc5cdd5571, block_num: 576745, block_time: 2019-05-03T06:07:54.500, producer_block_id: null, account_ram_deltas: [], except: null, inline_traces: []}, {receipt: {receiver: alice, act_digest: 117d5840be4ff21fad764d5d497182916f76e772b279e65e964bccfa7c888331, global_sequence: 576796, recv_sequence: 15, auth_sequence: [[bob, 39]], code_sequence: 1, abi_sequence: 1}, act: {account: eosio.token, name: transfer, authorization: [{actor: bob, permission: active}], data: {from: bob, to: alice, quantity: 0.0001 SYS, memo: }, hex_data: 0000000000000e3d0000000000855c340100000000000000045359530000000000}, context_free: false, elapsed: 2, console: , trx_id: c28bf8c168741adb96f3aef8723e953140cc60ecd20cec0d22e5a2dc5cdd5571, block_num: 576745, block_time: 2019-05-03T06:07:54.500, producer_block_id: null, account_ram_deltas: [], except: null, inline_traces: []}]}], except: null}}
client.pushTransaction(transaction, broadcast: true).then((trx) {
print(trx);
});
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
关于flutter-dependencies - 尝试将 'as prefix' 用于导入的指令之一,或隐藏除导入指令之外的所有指令的名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57951672/
我想知道这在 SQL 中是否可行。假设您有两个表 A 和 B,并且您对表 A 进行选择并在表 B 上进行联接: SELECT a.*, b.* FROM TABLE_A a JOIN TABLE_B
我认为这只是一个一般的 C++ 问题: 我正在尝试使用 gnu c++ 编译器在 Linux Fedora 上编译本地版本的 ffmpeg。我的源代码位于以下一堆文件夹中: ~//Downloads/
我听说在 Linux 上编译 PHP 时设置 --prefix=PREFIX 选项将允许您一次安装多个 PHP 而不会发生冲突。 (我认为如果未设置默认值是 /usr/local)。但是,我不确定它到
我有以下 conda 环境文件 environment.yml: name: testproject channels: - defaults dependencies: - python=3.7 p
目前在我的 Makefile 中我有: prefix ?= /usr/local 这样我就可以在调用 make 时覆盖 prefix 值,如下所示: make prefix="/new_path" 我
我正在尝试创建一个计算 pptx 中单词的函数文档。问题是我不知道如何只找到这种标签: Some Text 当我尝试:print xmlTree.findall('.//a:t') , 它返回 Syn
gitconfig(1) : If not set explicitly with --file, there are four files where git config will search
嗨,我是 Spring MVC 的新手,我正在关注 Spring 引用文档,我对 View 解析器有疑问。这是我的示例代码。 @Controller @RequestMapping("/form")
我一般都是通过pip安装python包的。 对于 Google App Engine,我需要将包安装到另一个目标目录。 我试过了: pip install -I flask-restful --tar
我对一些使用指令 ngb-pagination 的组件进行了 Angular 测试。来自 ng-bootstrap . 现在,在我的测试中,我模拟这个组件如下: // on next line I g
我无法运行npm install npm@latest -g,而不会遇到权限错误并被迫使用sudo npm install npm@latest -g。我可以在不使用 sudo 的情况下运行它,但是
假设我有一个字符串公式,它的格式是:“func(a+b,c)”,其中func是一个定制函数,这个字符串同时包含中缀(即+)和前缀(即func)表示,我想将其转换为具有所有前缀表示的字符串,“func(
我已经写下了一个简单的函数来确定 str1 是否是 str2 的前缀。这是一个非常简单的函数,看起来像这样(在 JS 中): function isPrefix(str1, str2) // dete
我们有 git remote add origin http://...避免重复输入实际的源代码库路径。但是如何git subtree --prefix=... ?每次拉/推子树内容时,很难跟踪、记住
我的 travis 工作遇到了以下问题: Process Output:Could not find platform independent libraries Process Output:Co
我正在阅读 Artifice 的来源并看到: module Artifice NET_HTTP = ::Net::HTTP # ... end 行:https://github.com/wyc
我正在阅读有关 Angular 路由的文档并创建了一个简单的测试: const routes: Route[] = [ { path: '', redirectTo: '/home', pat
所以使用 Material 我们有一些代码来问一个问题,我们想在输入的前面添加一个 $ 符号或使用占位符。在这个垫子字段内部,我们还有一个垫子标签。如果我使用 matprefix,它会将美元符号放在标
目前我希望为 Apache Mesos 编写一个脚本来启动主/从(在 2 个不同的节点上)。 我有引用http://mesos.apache.org/documentation/latest/depl
我已为文档建立索引,每个文档都有一个字段:“CodeName”,其值类似于以下内容: document 1 has CodeName: "AAA01" document 2 has CodeName:
我是一名优秀的程序员,十分优秀!