finotescore 0.0.1-dev.5 finotescore: ^0.0.1-dev.5 copied to clipboard
Detect and report bugs in Flutter based mobile apps. Reports issues like memory leaks, crashes, ANR and exceptions. Plugin has low memory and size footprint.
import 'dart:async';
import 'package:finotescore/finotescore.dart';
import 'package:finotescore/state_custom.dart';
import 'package:flutter/material.dart';
Widget? rootWidget;
void main() {
runApp(const MyApp());
WidgetsFlutterBinding.ensureInitialized(); //Make sure to execute 'ensureInitialized' before executing Fn.init().
Fn.logMe();
Fn.init(); //Need to call this function to activate plugin.
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends FnState<MyApp> { //Replace 'State' class with 'FnState' to allow finotescore plugin to track lifecycle methods.
@override
void initState() {
super.initState();
}
void _incrementCounter() {
Fn.setActivityMarker("increment_counter", "User tapped on increment counter"); //Set actvivity markers to get context on issues.
runZonedGuarded(() async {
//Increment value
}, (error, stackTrace) {
Fn.reportError(error, stackTrace); //Single line API to report zoned errors.
});
}
@override
Widget build(BuildContext context) {
super.build(context);
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: const Center(
child: Text('Running'),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
),
);
}
}