Skip to content

Software Development at Program Tom LTD

Place for coding, programming, development and software in general.

Menu
  • Blog
  • PDF Booklets
  • Dev Utils & Content
  • Java Spring Boot Or Web Apps
  • English
    • български
    • English
    • Español
    • Português
    • हिन्दी
    • Русский
    • Deutsch
    • Français
    • Italiano
    • العربية
  • About Us
  • Cart
Menu
Flutter image scaling

Flutter image scaling

Posted on November 6, 2025 by Toma Velev

How Flutter handles images and asset density and scaling differently than Android’s legacy drawable-*dpi folders? Let’s break it down clearly 👇

🧩 1. How Flutter handles multiple resolutions

Flutter doesn’t use the drawable-mdpi, drawable-hdpi, etc. system directly.
Instead, it uses device pixel ratios (DPR) and asset variants.

You can define image variants like this:

assets/
  images/
    icon.png          ← base image (1.0x)
    2.0x/icon.png     ← for DPR 2.0 (e.g. Retina, xxhdpi)
    3.0x/icon.png     ← for DPR 3.0 (xxxhdpi)

And in your pubspec.yaml:

flutter:
  assets:
    - assets/images/icon.png

Flutter automatically detects and uses the correct resolution image for:

  • ✅ Android (drawable-*dpi)
  • ✅ iOS (Retina)
  • ✅ Web
  • ✅ Windows
  • ✅ macOS
  • ✅ Linux

It’s completely cross-platform — Flutter’s rendering engine does the scaling.

🧠 2. How it works behind the scenes

  • When your app runs, Flutter reads the device’s MediaQuery.devicePixelRatio (e.g. 1.0, 2.0, 3.0).
  • It then chooses the closest matching variant (1.0x, 2.0x, 3.0x) automatically.
  • You only need to declare the base asset path in pubspec.yaml.

📐 3. Example structure mapping

Android density Typical devicePixelRatio Flutter folder
mdpi 1.0x assets/images/
hdpi 1.5x assets/images/1.5x/
xhdpi 2.0x assets/images/2.0x/
xxhdpi 3.0x assets/images/3.0x/
xxxhdpi 4.0x assets/images/4.0x/

🧰 4. Bonus: Vector assets

If you want fully scalable cross-platform graphics, use:

  • .svg with flutter_svg
  • .flr (Rive) animations
  • .json (Lottie)

These scale perfectly on all platforms, removing the need for bitmap variants.

✅ TL;DR

Goal Solution
Use multiple density bitmaps Put them in 1.0x/, 2.0x/, 3.0x/ subfolders
Work across Android/iOS/Web/Desktop ✅ Flutter does it automatically
Prefer full scalability Use SVG or Lottie
  • Prompt-to-Production: How AI is Forcing Us to Build Higher Quality Software
  • Debug Web View Flutter App
  • Skipping AI? You’re a Relic – Time to Evolve or Perish!
  • 2026 Flutter Launch Blueprint: Your 10-Step Checklist to App Store Domination
  • Product Requirements Document – for different software development levels

Categories

  • Apps (25)
  • ChatGPT (27)
  • Choosing a Framework (38)
  • Flutter (281)
  • Graphical User Interface (14)
  • Marketing (119)
  • Software Development (292)
  • Spring (45)
  • StartUp (22)
  • Uncategorized (14)
  • Uncategorized (4)
  • Vaadin (16)

Tags

Algorithms (9) crypto (29) flutterdev (39) General (86) Java (7) QR & Bar Codes (3) Software Dev Choices (33) Spring Boot (1) standards (1) Theme (3) User Authentication & Authorization (9) User Experience (10) Utilities (19) WordPress (11)

Product categories

  • All Technologies (87)
    • Flutter Apps (26)
    • GPT (4)
    • Java (39)
    • Native Android (3)
    • PHP (9)
    • Spring (Boot) / Quarkus (36)
    • Utils (15)
    • Vaadin 24+ (28)
    • Vaadin 8 (1)
  • Apps (18)
    • Employees DB (1)
    • Notes (6)
    • Personal Budget (1)
    • Recipes Book (1)
    • Stuff Organizer (1)
    • To-Do (2)
  • PDF Books (3)
  • Source Code Generators (8)

Recent Posts

  • Prompt-to-Production: How AI is Forcing Us to Build Higher Quality Software
  • Debug Web View Flutter App
  • Skipping AI? You’re a Relic – Time to Evolve or Perish!
  • 2026 Flutter Launch Blueprint: Your 10-Step Checklist to App Store Domination
  • Product Requirements Document – for different software development levels

Post Categories

  • Apps (25)
  • ChatGPT (27)
  • Choosing a Framework (38)
  • Flutter (281)
  • Graphical User Interface (14)
  • Marketing (119)
  • Software Development (292)
  • Spring (45)
  • StartUp (22)
  • Uncategorized (14)
  • Uncategorized (4)
  • Vaadin (16)