Small details that build taste in Flutter.

curated by Kamran BekirovKamran Bekirov

Find the images that waste memory

Some images in your app take far more memory than they should. A photo you display in 400x300 can be 4000×3000 in real. You can't see that by looking at the screen, the app looks fine.

Flutter has a debug flag that makes it visible:

void main() {
  debugInvertOversizedImages = true;
  
  runApp(const App());
}

Now every image that was unpacked much bigger than its size on screen is drawn upside down, with the colors inverted, like a photo negative:

It's ugly on purpose. A warning in the console is easy to ignore, an upside down photo is not. And the flag only works in debug mode, so it can never reach your users.

Read Load images at the size you show them to learn about cacheWidth and how to avoid these memory wastes.

Kamran Bekirov
Kamran Bekirov

Want this level of care in your Flutter apps?

Work With Me