仅仅是 Logcat
特点
Log.i, Log.d, Log.w, Log.e
入门
flutter pub add just_logcat
flutter pub get
用法
信息日志
...
import 'package:just_logcat/just_logcat.dart';
...
const tag = 'main.dart';
void main() {
Log.i(tag, 'Before running MyApp()');
try {
...
} catch (error, stackTrace) {
Log.i(tag, 'Error: $error', stackTrace: stackTrace);
}
runApp(const MyApp());
}
}
...
调试日志
...
import 'package:just_logcat/just_logcat.dart';
...
const tag = 'main.dart';
void main() {
Log.d(tag, 'Before running MyApp()');
try {
...
} catch (error, stackTrace) {
Log.d(tag, 'Error: $error', stackTrace: stackTrace);
}
runApp(const MyApp());
}
}
...
警告日志
...
import 'package:just_logcat/just_logcat.dart';
...
const tag = 'main.dart';
void main() {
Log.w(tag, 'Before running MyApp()');
try {
...
} catch (error, stackTrace) {
Log.w(tag, 'Error: $error', stackTrace: stackTrace);
}
runApp(const MyApp());
}
}
...
错误日志
...
import 'package:just_logcat/just_logcat.dart';
...
const tag = 'main.dart';
void main() {
Log.e(tag, 'Before running MyApp()');
try {
...
} catch (error, stackTrace) {
Log.e(tag, 'Error: $error', stackTrace: stackTrace);
}
runApp(const MyApp());
}
}
...
附加信息
仅仅是 logcat