A simple Flutter package project to store, view, and manage app console log, API logs.
Base log type:
verbose
(Default, with black color text)info
(Blue color text)error
(Red color text)
In the dependencies:
section of your pubspec.yaml
, add the following line:
dependencies:
console_flutter: <latest_version>
In main function
import 'package:console_flutter/console_flutter.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
Console.logEnabled(kDebugMode); // false will ignore Console view
runApp(MyApp());
}
In your app
import 'package:console_flutter/console_flutter.dart';
class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
...
body: ConsoleWrapper(
child: MyHomePage(),
),
);
}
}
Custom your view and action to open Logs Screen
import 'package:console_flutter/console_flutter.dart';
Console.showConsoleLog(context);