Skip to content

Instantly share code, notes, and snippets.

@ponnamkarthik
Created April 22, 2018 10:02
Show Gist options
  • Save ponnamkarthik/b1859656cd82aca13a36701f0504ffc0 to your computer and use it in GitHub Desktop.
Save ponnamkarthik/b1859656cd82aca13a36701f0504ffc0 to your computer and use it in GitHub Desktop.
example/main.dart in FlutterNativeLogPlugin
import 'package:flutter/material.dart';
import 'package:flutter_native_log/flutter_native_log.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
initState() {
super.initState();
printLogs();
}
void printLogs() async {
print(await FlutterNativeLog.printLog(tag: "Karthik", msg: "This is Test Log")); // default logType
print(await FlutterNativeLog.printLog(tag: "Karthik", msg: "This is Test Log", logType: Log.WARNING)); // logType = warning
print(await FlutterNativeLog.printLog(tag: "Karthik", msg: "This is Test Log", logType: Log.ERROR)); // logType = error
print(await FlutterNativeLog.printLog(tag: "Karthik", msg: "This is Test Log", logType: Log.DEBUG)); // logType = debug
}
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Scaffold(
appBar: new AppBar(
title: new Text('Plugin example app'),
),
body: new Center(
child: new Text('Hello'),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment