title: Flutter loading Image asset too slow
body: <p>So, I have a screen which shows a text and an image above the text and loads, in background, some data from the shared preferences.</p>
  
  <p>But the image is taking forever to load, and when I remove the call to get the shared preferences data the image loads very quiclky. Do someone knows if I'm doing something wrong with this call? </p>
  
  <p>here's the code:</p>
  
  <pre class="lang-dart prettyprint-override"><code>class WelcomeScreen extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      precacheImage(AssetImage(Images.tomato), context);
      _loadData(context);
      return Scaffold(
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              Text(
                Strings.appName,
                style: TextStyle(
                  color: AppColors.black,
                  fontSize: 50.0,
                  fontWeight: FontWeight.w600,
                ),
              ),
              Image.asset(Images.tomato),
            ],
          ),
        ),
      );
    }
  
    void _loadData(BuildContext context) async {
      final PreferencesRepository repository = PreferenceRepositoryImp();
      repository.loadAll().then(
        (_) {
          sleep(Duration(seconds: 2));
          Navigator.pushNamedAndRemoveUntil(context, Routes.HOME, (_) =&gt; false);
        },
      );
    }
  }
  </code></pre>
  
  <p>and that's the image</p>
  
  <p><img src="https://i.ibb.co/MZzRGpY/tomato.png" alt="&quot;tomato&quot;"></p>