How to solve flutter Infinity or NaN toInt on some images

How to solve flutter Infinity or NaN toInt on some images

I solved it. Turns out that I should not use hot-reload after adding a new assets. All I needed was to stop the project and re-run it afresh.

Did you place your assets in the pubspec.yaml file?

flutter:
  assets:
    - assets/imgs/

How to solve flutter Infinity or NaN toInt on some images

I could not reproduce your errors, I will suggest you to try the following code :


body: SingleChildScrollView(
        child: Container(
           child: Image.asset(assets/imgs/curved.png,
                fit: BoxFit.cover,
                width: 500,
                height: 200,
             ),
          ),
       ),

Does using Image.network also give you an error. Please check if the following image gives error:

Image.network(https://placeimg.com/1080/768/any,
        width: 500, height: 200)

Leave a Reply

Your email address will not be published.