android_app_info 0.0.4

  • Example
  • Installing
  • Versions
  • 7

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:android_app_info/android_app_info.dart';

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

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

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  List<AndroidAppInfo> _apps = [];

  @override
  initState() {
    super.initState();
    initPlatformState();
  }

  initPlatformState() async {
    String platformVersion;
    try {
      platformVersion = await AndroidAppInfo.platformVersion;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // THIS IS THE MAGIC
    // Grabs the list of avaiable application activities.
    // If you want the actual *applications*, try AndroidAppInfo.getInstalledApplications.
    // (They both return Future<List<AndroidAppInfo>>).
    var apps = await AndroidAppInfo.getAvailableActivities();

    if (!mounted)
      return;

    setState(() {
      _platformVersion = platformVersion;
      _apps = apps;
    });
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        ),
        body: new ListView.builder(
          itemCount: _apps.length,
          itemBuilder: (BuildContext context, int index) {
            var app = _apps[index];
            return new ListTile(
              // For a full list of the properties on an AndroidAppInfo instance, see the source
              // app.icon is the app's icon
              // app.defaultIcon is the default application icon
              leading: new Image.memory(app.icon ?? app.defaultIcon),
              // obvious...
              title: new Text(app.label ?? app.name ?? 'Unknown'),
              // also obvious...
              subtitle: new Text('${app.packageName}'),
              onTap: () => app.start(),
            );
          },
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  android_app_info: "^0.0.4"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


      import 'package:android_app_info/android_app_info.dart';
  
Version Uploaded Documentation Archive
0.0.4 Aug 17, 2017 Go to the documentation of android_app_info 0.0.4 Download android_app_info 0.0.4 archive
0.0.3 Aug 16, 2017 Go to the documentation of android_app_info 0.0.3 Download android_app_info 0.0.3 archive
0.0.2 Aug 3, 2017 Go to the documentation of android_app_info 0.0.2 Download android_app_info 0.0.2 archive
0.0.1 Aug 3, 2017 Go to the documentation of android_app_info 0.0.1 Download android_app_info 0.0.1 archive

Analysis

We analyzed this package on Jun 19, 2018, and provided a score, details, and suggestions below. Analysis was completed with status tool failures using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3
  • Flutter: 0.5.4

Scores

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

Platforms

Detected platforms: unsure

Error(s) prevent platform classification:

Make sure flutter format runs.

Suggestions

  • Make sure flutter format runs.

    Running flutter format failed with the following output:

    dartfmt on lib/ failed with exit code 255
    Unhandled exception:
    type 'SubListIterable<AnalysisError>' is not a subtype of type 'List<AnalysisError>'
    #0      FormatterException.message (package:dart_style/src/exceptions.dart:26:50)
    #1      processFile (package:dart_style/src/io.dart:83:24)
    #2      processDirectory (package:dart_style/src/io.dart:58:10)
    #3      formatPaths (file:///tmp/tmpaawQIb/dart-2.0.0-dev.63.0/dart/third_party/pkg_tested/dart_style/bin/format.dart:221:12)
    #4      main (file:///tmp/tmpaawQIb/dart-2.0.0-dev.63.0/dart/third_party/pkg_tested/dart_style/bin/format.dart:159:5)
    #5      _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:277:32)
    #6      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)
    
  • Fix platform conflicts.

    Error(s) prevent platform classification:

    Make sure flutter format runs.

  • Running dartdoc failed.

    Make sure dartdoc runs without any issues.

  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Maintain README.md.

    Readme should inform others about your project, what it does, and how they can use it.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 38 errors 5 warnings 1 hint.

    Make sure that the imported libraries are not in conflict. Error(s) in lib/android_app_info.dart: 'name' isn't a field in the enclosing class.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
flutter 0.0.0
Transitive dependencies
collection 1.14.6 1.14.10
meta 1.1.5
sky_engine 0.0.99
typed_data 1.1.5
vector_math 2.0.6 2.0.7