exitinfo 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 50

exitinfo #

Wrapper for ApplicationExitInfo API

Getting Started #

This plugin is wrapper for ApplicationExitInfo Android API that was added in API level R. ApplicationExitInfo API describes the information of previous application process's death.

Plugin provided all information that can be retrieved from native android code.

IMPORTANT: Until Android R is officially published, this package can only be tested devices with installed beta version of Android R.

Usage #

Import

import 'package:exitinfo/exitinfo.dart';

Retrieving list of exit reasons

List<ExitInfo> exitInfoList = await ExitInfoApi.exitinfo;

Getters

exitInfoList.first.description;
exitInfoList.first.reason;
exitInfoList.first.timestamp;
exitInfoList.first.status;
exitInfoList.first.processname;
exitInfoList.first.packageId;
exitInfoList.first.importance;
exitInfoList.first.packageId;

Example app #

alt text

Features and bugs #

If you any problem using library or you have any new needs, please file feature requests and bugs at the issue tracker.

0.1.1 #

  • Fix description

0.1.0 #

  • Fix description and formatting

0.0.1 #

  • Initial version

example/lib/main.dart

import 'package:exitinfo/gen/protos/exitinfo.pb.dart';
import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:exitinfo/exitinfo.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  List<ExitInfo> _exitInfoList;
  String _err = "";

  @override
  void initState() {
    super.initState();
    initExitInfo();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initExitInfo() async {
    List<ExitInfo> exitInfoList;
    String err;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      exitInfoList = await ExitInfoApi.exitinfo;
      exitInfoList.sort((a, b) => b.timestamp.compareTo(a.timestamp));
    } on PlatformException catch (e) {
      exitInfoList = null;
      err = e.message;
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _exitInfoList = exitInfoList;
      _err = err;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('ExitInfo example app'),
        ),
        body: Center(
          child: _exitInfoList != null
              ? ListView.builder(
                  itemCount: _exitInfoList?.length ?? 0,
                  itemBuilder: (BuildContext context, int index) {
                    return Card(
                      child: Column(
                        children: <Widget>[
                          Row(
                            children: <Widget>[
                              Expanded(child: Text("Reason")),
                              Expanded(flex: 2, child: Text(_exitInfoList[index].reason.name)),
                            ],
                          ),
                          Row(
                            children: <Widget>[
                              Expanded(child: Text("Description")),
                              Expanded(flex: 2, child: Text(_exitInfoList[index].description)),
                            ],
                          ),
                          Row(
                            children: <Widget>[
                              Expanded(child: Text("Timestamp")),
                              Expanded(
                                  flex: 2,
                                  child: Text(
                                      DateTime.fromMillisecondsSinceEpoch(_exitInfoList[index].timestamp.toInt())
                                          .toString())),
                            ],
                          ),
                        ],
                      ),
                    );
                  },
                )
              : Text(_err),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  exitinfo: ^0.1.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:exitinfo/exitinfo.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Jul 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform ios

Because of import path [package:exitinfo/exitinfo.dart] that declares support for platforms: android

Package does not support Flutter platform linux

Because of import path [package:exitinfo/exitinfo.dart] that declares support for platforms: android

Package does not support Flutter platform macos

Because of import path [package:exitinfo/exitinfo.dart] that declares support for platforms: android

Package does not support Flutter platform web

Because of import path [package:exitinfo/exitinfo.dart] that declares support for platforms: android

Package does not support Flutter platform windows

Because of import path [package:exitinfo/exitinfo.dart] that declares support for platforms: android

Package not compatible with SDK dart

because of import path [exitinfo] that is in a package requiring null.

Health suggestions

Format lib/gen/protos/exitinfo.pb.dart.

Run flutter format to format lib/gen/protos/exitinfo.pb.dart.

Format lib/gen/protos/exitinfo.pbenum.dart.

Run flutter format to format lib/gen/protos/exitinfo.pbenum.dart.

Format lib/gen/protos/exitinfo.pbjson.dart.

Run flutter format to format lib/gen/protos/exitinfo.pbjson.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
fixnum ^0.10.11 0.10.11
flutter 0.0.0
protobuf ^1.0.1 1.0.1
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test