Finotes Core (finotescore)

Flutter plugin with the ability to detect and report bugs in Android and iOS mobile apps.

Getting started

  1. Register with Finotes using the 'Get Started' button in https://finotes.com and login to dashboard.
  2. Use "Add App" to link Android and iOS applications to Finotes.
  3. Integrate Finotes plugin to your application.
  4. Test your integration.

Prerequisites for Integration

Plugin supports dart SDK versions greater than or equal to 2.16.2 and less than 3.0.0. Flutter version should be greater than or equal to 2.5.0.

Integrating plugin

Add finotescore to pubspec.yaml file.

dependencies:
  finotescore: ^version

Initializing Finotes

Call Fn.init() function within the main function. Make sure to call WidgetsFlutterBinding.ensureInitialized() before calling init API.

void main() {
    runApp(const MyApp());

    WidgetsFlutterBinding.ensureInitialized();
    Fn.init();

}

Setting Proguard Rules

If you are using proguard in release build, you need to add the following to the proguard-rules.pro file.

proguard-rules.pro:

-keep class com.finotes.android.finotescore.* { *; }

-keepclassmembers class * {
    @com.finotes.android.finotescore.annotation.Observe *;
}

Add below line to keep the exact line number and source file name in the stacktrace.

proguard-rules.pro:

-keepattributes SourceFile,LineNumberTable

Please make sure that the mapping file of production build (each build) is backed up, inorder to deobfuscate the stacktrace from Finotes dashboard. Location of mapping file: project-folder/app/build/outputs/proguard/release/mapping.txt

Testing Integration

Now that the basic integration of Finotes plugin is complete, Let us make sure that the dashboard and plugin are in sync.

Step One

Add Fn.test() under Fn.init

import 'package:finotescore/finotescore.dart';

....
void main() {
    runApp(const MyApp());

    WidgetsFlutterBinding.ensureInitialized();
    Fn.init();

    Fn.test(); //Line to raise test issue.
}

Step Two

Once the application opens up, open Finotes dash. The test issue that we raised should be reported.

Remember to remove the Fn.test() call, else every time the app is run, an issue will be reported.

Crash Reporting

With basic integration, Finotes will track and report uncaught exceptions to Finotes dashboard automatically.

Report GuardedZone Errors

Any exceptions that may have already been caught within the Zone needs to be reported as they might prevent the application from crashing, but at the same time can make app unstable if gone unreported.

    runZonedGuarded<Future<void>>(() async {
      
        ....

    }, (dynamic error, StackTrace stackTrace) {
        Fn.reportError(error, stackTrace); //Single line API to report caught errors. 
    });

Report Custom Issues

Report custom issues using the Fn.reportIssue() API.

    Fn.reportIssue("Main App", "Payment failed", "Payment failed when selecting basic package");

Memory Leaks

In order to capture memory leaks in the application, extend the State class from custom class FnState provided along with the plugin. The plugin now reports memory leaks from dart code and native platforms (Java, Kotlin, Swift and Obj-c) as separate tickets.

class _MyAppState extends FnState<MyApp> { //Replace State class with FnState class.
    ....

}

Track UI block issues

This feature is automatically activated in the plugin. With basic integration Finotes will track and report UI/ Main thread blocks that can lead to App Not Responding (ANR) situations in Android and AppHangs in iOS/iPadOS.

Hot Restart causes main Isolate block

During development "hot restart" mode used to re-run the application will cause main isolate to be blocked temporarily. As the main isolate is blocked, FinotesCore plugin will raise an issue report to dashboard.

Report HTTP(s) Issues

FinotesCore plugin supports tracking HTTP(s) call made using both http and http_interceptor plugins.

HTTP client based

Replace http.Client with FnClient provided in FinoteCore plugin.

    import 'package:finotescore/fn_client.dart';


    ....
    var client = http.Client(); //Regular http client to make calls.

    var client = FnClient(); //Replace your http client with finotescore client.

Interceptor based

Add FnInterceptor to the list of interceptors to enable FinotesCore plugin track HTTP(s) calls.

    import 'package:finotescore/fn_interceptor.dart';

    ....
    http.Client client = InterceptedClient.build(interceptors: [
      CustomInterceptor, FnInterceptor(), //Add finotescore interceptor to track api calls.
    ]);

Masking Header fields

Call the setMaskedHeaders function to specify the list of header keys that need to be masked. Once set all header field values with the keys listed in the function will be masked from the device side itself. This feature can be used to mask sensitive header fields.

  Observe().setMaskedHeaders(["X-Key"]);

Activity Trail

Activity markers are events that occur in an application during runtime. In order to capture lifecycle events of states used in the application, extend the State class from custom class FnState provided along with the plugin.

class _MyAppState extends FnState<MyApp> { //Replace State class with FnState class.
    ....

    @override
    Widget build(BuildContext context) {
        super.build(context); //Make sure to call the super here.
        return ..
    }
}

Settings custom activity trail

Developers can set custom activity trail markers anywhere in the app using Fn.setActivityMarker(). These markers will be shown along with the lifecycle events, when an issue is reported.

    Fn.setActivityMarker("Main App", "User tapped on payment button");

Enable Finotes Logs

You can activate internal Finotes logging using logMe() API. Activating logMe() API will print all logs generated by the plugin including error and warning logs.

    Fn.logMe();

When preparing for production release, make sure to remove the log API.