add project
This commit is contained in:
37
lib/utils/console.dart
Normal file
37
lib/utils/console.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:logger/logger.dart';
|
||||
|
||||
class Console {
|
||||
static final Console _singleton = Console._internal();
|
||||
factory Console() {
|
||||
return _singleton;
|
||||
}
|
||||
static void log(text, anyObj) {
|
||||
final textLength = text.toString().length + 4;
|
||||
print(" " + '-' * textLength);
|
||||
print("| " + text + " |");
|
||||
print(" " + '-' * textLength);
|
||||
print(anyObj);
|
||||
print("==============================");
|
||||
print("==============================");
|
||||
}
|
||||
|
||||
static void json(data) {}
|
||||
|
||||
static void jsonAll(data) {
|
||||
JsonEncoder encoder = new JsonEncoder.withIndent(' ');
|
||||
String prettylint = encoder.convert(data);
|
||||
|
||||
prettylint
|
||||
.split('\n')
|
||||
.forEach((element) => Console.log("Render JSON", prettylint));
|
||||
}
|
||||
|
||||
static void better(message) {
|
||||
var logger = Logger();
|
||||
logger.e(message);
|
||||
}
|
||||
|
||||
Console._internal();
|
||||
}
|
||||
Reference in New Issue
Block a user