Created
April 22, 2018 10:02
-
-
Save ponnamkarthik/b1859656cd82aca13a36701f0504ffc0 to your computer and use it in GitHub Desktop.
example/main.dart in FlutterNativeLogPlugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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