Skip to content

kinhvodoi92/console_flutter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

console_flutter

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)

Installation

In the dependencies: section of your pubspec.yaml, add the following line:

dependencies:
  console_flutter: <latest_version>

Usage

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());
}
  • Method 1: WrapperWidget

In your app

import 'package:console_flutter/console_flutter.dart';

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
        ...
        body: ConsoleWrapper(
            child: MyHomePage(),
        ),
    );
  }
}
  • Method 2: Custom Navigate

Custom your view and action to open Logs Screen

import 'package:console_flutter/console_flutter.dart';

Console.showConsoleLog(context);