title: How to solve flutter "Infinity or NaN toInt" on some images
body: <p>I have a simple project that should just display an image. I should mention that am very new to flutter.</p>
  <p>Below is the main.dart</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:flutter_shoe/ColorHolder.dart';
  import 'package:flutter_shoe/home_page.dart';
  import 'package:flutter_shoe/profile_page.dart';
  
  void main() {
    runApp(MyApp());
  }
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          primaryColor: primaryColor,
          visualDensity: VisualDensity.adaptivePlatformDensity,
        ),
        home: HomePage(),
      );
    }
  }
  </code></pre>
  <p>And here is the HomepageClass</p>
  <pre><code>import 'package:flutter/material.dart';
  
  class HomePage extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          leading: Icon(Icons.menu),
          title: Text(&quot;Home&quot;),
          centerTitle: true,
          actions: [
            Icon(Icons.circle_notifications),
          ],
        ),
        body: Container(
          child: Image.asset(
            &quot;assets/imgs/curved.png&quot;,
            // &quot;assets/imgs/doc.jpg&quot;,
            width: 500,
            height: 200,
          ),
        ),
      );
    }
  }
  </code></pre>
  <p>The above code is giving me the error</p>
  <pre><code>Unsupported operation: Infinity or NaN toInt
  </code></pre>
  <p>The error points to the line that contains the image asset.</p>
  <p>I have tried using several different images and it is working well with some images and gives error on other images. I need it to always work with all images.</p>
  <p>A sample working image has dimensions 626 by 626 and is jpg
  A sample non working image has dimension 1080 by 768 and is png</p>
  <p>I have tried replacing container with Expandable.
  I have appended height and width value to the container. Still not working
  I have changed the width and height of image to double.maxFinite. Not working.</p>
  <p>I don't find anything on their docs that is helping.</p>
  <p>Someone help me know where I am going wrong.</p>