title: Get app icons of installed apps in Flutter from device_apps plugin
body: <p>I was figuring out how to display list of installed apps along with their names &amp; icons. Code works well till displaying app names. Here is the right, working code:</p>
  
  <pre><code>import 'package:flutter/material.dart';
  import 'package:device_apps/device_apps.dart';
  import 'dart:async';
  
  class FirstScreen extends StatefulWidget{
    State&lt;StatefulWidget&gt; createState(){
      return _FirstScreen();
    }
  }
  
  class _FirstScreen extends State&lt;FirstScreen&gt;{
    List&lt;Application&gt; apps;
    void initState(){
      super.initState();
    }
  
    Future&lt;void&gt; getApp() async{
      List&lt;Application&gt; _apps = await DeviceApps.getInstalledApplications(onlyAppsWithLaunchIntent: true, includeAppIcons: true, includeSystemApps: true);
      setState(() {
        apps = _apps;
      });
    }
  
    Widget build(BuildContext context) {
      getApp();
      return Container(
          child: ListView.builder(
            itemCount: apps.length,
            itemBuilder: (context, index){
              return ListTile(
                title: Text(apps[index].appName),
              );
            },
          )
      );
    }
  }
  </code></pre>
  
  <p>but when I display app icon in ListTile by:</p>
  
  <pre><code>trailing: Icon(Image.memory(apps[index].icon))
  </code></pre>
  
  <p>it gives <a href="https://i.stack.imgur.com/7F9gb.png" rel="nofollow noreferrer">icon not defined</a> error.</p>
  
  <p>I even tried <strong>ApplicationWithIcon</strong> class which extends Application class &amp; <em>icon</em> defined in it, but it returned <a href="https://i.stack.imgur.com/64kJL.png" rel="nofollow noreferrer">Null Error</a></p>