Skip to content
tezvyn:

Deferred Components: On-Demand Features in Flutter

Source: docs.flutter.devHardHow cards are made

Think of deferred components as downloadable content for your app. They reduce initial install size by letting you download features on demand. This is ideal for large, rarely-used functions on Android and web, but requires handling loading states and network…

Why it exists

To combat app bloat. Large applications suffer from lower install conversion rates and can be slow to start. Deferring non-critical features to a later, on-demand download makes the initial user experience faster and lighter, which is especially important on mobile and web platforms.

The mental model

It's like a video game that ships with the main campaign and lets you download optional DLC packs later. The core app is fully functional, but extra content—like new features, widgets, or large assets—is fetched from the app store or a server only when the user requests it. This effectively splits your single, monolithic app into a lean base module and several dynamic feature modules.

How it works

You define certain parts of your Flutter app as separate, loadable modules. At build time, the Flutter toolchain packages these as distinct files. The base app contains logic to request, download, and then integrate these modules at runtime. This typically involves using a platform-specific API, like Android's Play Feature Delivery, to manage the download. Once downloaded, your Flutter code can dynamically load the Dart code and assets from the new module.

When to use it

Use this for features that are large and not essential for the app's primary function or first-run experience. Good candidates include complex user flows only a subset of users will access (like an enterprise admin panel), features reliant on large assets (like AR filters or high-resolution tutorials), or optional functionality that would significantly increase the base app size. The source confirms this is for Android and web.

When not to use it

Don't defer core functionality or anything needed for the app's initial startup and main user journey. The added complexity of managing loading states, network errors, and version compatibility is not worth it for small features. It also introduces a point of failure if the user is offline or has a slow connection when they first try to access the deferred feature.

One canonical example

A news app could ship with its core article-reading functionality. A complex, data-heavy "interactive map of historical events" feature could be packaged as a deferred component. Most users who just want to read the news never download it, keeping the app small. A user who navigates to the map section would trigger an on-demand download of the feature.

Interview question

Which scenario best exemplifies an appropriate use case for Flutter's Deferred Components?

  • a.An initial onboarding tutorial that all new users must complete upon first launch.
  • b.A core navigation system essential for the app's primary user journey.
  • c.A small, frequently accessed settings panel that personalizes user preferences.
  • d.A large, optional feature like an interactive 3D product configurator for a niche user segment.Correct
Why?

The correct answer (D) describes a large, optional feature for a subset of users, which perfectly matches the criteria for deferred components: reducing initial app size by downloading non-essential, large content on demand. Options A, B, and D represent scenarios where deferred components are explicitly discouraged due to being core functionality, small features not justifying complexity, or initial startup requirements.

Just read this? Test yourself on what you have been reading.

Read the original → docs.flutter.dev

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on flutter — each one lists the topics its interview covers.

See open roles