mirror of
https://github.com/wownero/cyberwow.git
synced 2026-10-18 16:01:38 +02:00
use final when possible
This commit is contained in:
@@ -45,18 +45,17 @@ Future<http.Response> rpcHTTP(String method) async {
|
||||
}
|
||||
);
|
||||
|
||||
var response;
|
||||
try {
|
||||
response = await http.post
|
||||
final response = await http.post
|
||||
( url,
|
||||
body: body
|
||||
);
|
||||
return response;
|
||||
}
|
||||
catch (e) {
|
||||
// print(e);
|
||||
log.warning(e);
|
||||
return null;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<dynamic> rpc(String method, {String field}) async {
|
||||
|
||||
@@ -32,17 +32,16 @@ import '../../logging.dart';
|
||||
Future<http.Response> rpc2(String method) async {
|
||||
final url = 'http://${config.host}:${config.c.port}/${method}';
|
||||
|
||||
var response;
|
||||
try {
|
||||
response = await http.post
|
||||
final response = await http.post
|
||||
( url,
|
||||
);
|
||||
return response;
|
||||
}
|
||||
catch (e) {
|
||||
log.warning(e);
|
||||
return null;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<String> rpc2String(String method, {String field}) async {
|
||||
|
||||
@@ -60,7 +60,7 @@ Stream<String> runBinary (String name) async* {
|
||||
log.info('args: ' + args.toString());
|
||||
|
||||
final outputProcess = await Process.start(newPath, args);
|
||||
await for (var line in outputProcess.stdout.transform(utf8.decoder)) {
|
||||
await for (final line in outputProcess.stdout.transform(utf8.decoder)) {
|
||||
yield line;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ class LoadingState extends HookedState {
|
||||
|
||||
Future<void> load() async {
|
||||
log.fine("Loading next");
|
||||
await for (var line in loadingProgress) {
|
||||
await for (final line in loadingProgress) {
|
||||
// append(line);
|
||||
log.info(line);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ class SyncingState extends HookedState {
|
||||
log.fine("Syncing next");
|
||||
|
||||
Future<void> printStdout() async {
|
||||
await for (var line in processOutput) {
|
||||
await for (final line in processOutput) {
|
||||
if (synced) break;
|
||||
log.finest('syncing: print stdout loop');
|
||||
|
||||
@@ -166,7 +166,7 @@ class SyncingState extends HookedState {
|
||||
}
|
||||
|
||||
Future<void> checkSync() async {
|
||||
await for (var _null in refresh.pull(getNotification, 'syncingState')) {
|
||||
await for (final _null in refresh.pull(getNotification, 'syncingState')) {
|
||||
log.finer('SyncingState: checkSync loop');
|
||||
|
||||
// here doc is wrong, targetHeight could match height when synced
|
||||
@@ -210,7 +210,7 @@ class SyncedState extends HookedState {
|
||||
log.fine("Synced next");
|
||||
|
||||
Future<void> logStdout() async {
|
||||
await for (var line in processOutput) {
|
||||
await for (final line in processOutput) {
|
||||
if (!synced) break;
|
||||
// print('synced: print stdout loop');
|
||||
stdout += line;
|
||||
@@ -221,7 +221,7 @@ class SyncedState extends HookedState {
|
||||
logStdout();
|
||||
|
||||
Future<void> checkSync() async {
|
||||
await for (var _null in refresh.pull(getNotification, 'syncedState')) {
|
||||
await for (final _null in refresh.pull(getNotification, 'syncedState')) {
|
||||
if (await daemon.isNotSynced()) {
|
||||
synced = false;
|
||||
break;
|
||||
@@ -267,7 +267,7 @@ class ReSyncingState extends HookedState {
|
||||
log.fine("ReSyncing next");
|
||||
|
||||
Future<void> printStdout() async {
|
||||
await for (var line in processOutput) {
|
||||
await for (final line in processOutput) {
|
||||
if (synced) break;
|
||||
// print('re-syncing: print stdout loop');
|
||||
append(line);
|
||||
@@ -276,7 +276,7 @@ class ReSyncingState extends HookedState {
|
||||
}
|
||||
|
||||
Future<void> checkSync() async {
|
||||
await for (var _null in refresh.pull(getNotification, 'ReSyncingState')) {
|
||||
await for (final _null in refresh.pull(getNotification, 'ReSyncingState')) {
|
||||
|
||||
if (await daemon.isSynced()) {
|
||||
synced = true;
|
||||
|
||||
Reference in New Issue
Block a user