INNER CODE UNIT · Dart
NativeLogger
aayush2622/Dartotsu · lib/logger.dart:240
class NativeLogger {
static const _channel = MethodChannel('native_logger');
static bool _started = false;
static Future<void> startLogStream() async {
if (!Platform.isAndroid || _started) return;
_started = true;
_channel.setMethodCallHandler((call) async {
if (call.method == 'onLogs') {
final logs = (call.arguments as List).cast<String>();
for (final log in logs) {
logger(log, tag: 'native');
}
}
});
await _channel.invokeMethod('startLogs');