mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-25 11:45:59 +00:00
dev feat: pretty print json helper util
This commit is contained in:
parent
ee830a4788
commit
efd2742184
1 changed files with 13 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:developer';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
|
@ -50,4 +52,15 @@ abstract class Util {
|
||||||
}
|
}
|
||||||
return MaterialColor(color.value, swatch);
|
return MaterialColor(color.value, swatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void printJson(dynamic json) {
|
||||||
|
if (json is Map || json is List) {
|
||||||
|
final spaces = ' ' * 4;
|
||||||
|
final encoder = JsonEncoder.withIndent(spaces);
|
||||||
|
final pretty = encoder.convert(json);
|
||||||
|
log(pretty);
|
||||||
|
} else {
|
||||||
|
log(dynamic.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue