我已经导入了一个 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 …Run Code Online (Sandbox Code Playgroud) 在这里,我有一个实用程序类,其中有一个用于显示 DialogBox 的函数,所以我正在尝试制作一个 AlertDialog Box,它可以在整个项目的任何地方使用。
因此,我必须将 Title、description 作为参数传递,并且还想传递 Class name,以便在按下警报对话框内的按钮时我们可以导航到该屏幕
class DialogBox {
static DialogBox dialogBox = null;
static DialogBox getInstance() {
if (dialogBox == null) {
dialogBox = DialogBox();
}
return dialogBox;
}
showAlertDialog(BuildContext context, String alertTitle, String alertMessage) {
showDialog(
context: context,
barrierDismissible: false,
builder: (context) {
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),
title: Center(child: Text(alertTitle)),
content: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
alertMessage,
textAlign: TextAlign.center,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
FlatButton(
child: …Run Code Online (Sandbox Code Playgroud) 怎么做,请给个思路。它就像一个可以被其他所有类访问的全局类,我实际上想构建一个 util 类,以便所有这些东西都只在那里,我可以只用 util 类的对象来调用这些东西。
看这就是我一直在做的
SharedPreferences sharedPreferences;
sharedPreferences = await SharedPreferences.getInstance();
sharedPreferences.setString('uwr_name', ctrUwrName.text);
getCredential();
Run Code Online (Sandbox Code Playgroud)
这个 getCredentail() 方法我已经在我想要来自 sharePref 的数据的地方调用了。但我不知道我需要在设置数据时调用它,如果我在设置数据时不把它sharedpref 会报错
getCredential() async {
sharedPreferences = await SharedPreferences.getInstance();
}
Run Code Online (Sandbox Code Playgroud)