getApp method

Future<Application> getApp(
  1. String packageName,
  2. [bool includeAppIcon = false]

Provide all information for a given app by its packageName includeAppIcon will also include the icon for the app. To get it, you have to cast the object to ApplicationWithIcon.


static Future<Application> getApp(String packageName,
    [bool includeAppIcon = false]) async {
  if (packageName.isEmpty) {
    throw Exception('The package name can not be empty');

  return _channel.invokeMethod('getApp', <String, Object>{
    'package_name': packageName,
    'include_app_icon': includeAppIcon
  }).then((Object app) {
    if (app != null && app is Map) {
      return Application._(app);
    } else {
      return null;
  }).catchError((Object err) {
    return null;