skip to content

Flutter Ecosystem

The Flutter framework plus the libraries and tools around it: BLoC, Riverpod, Provider and other state libraries, the flutter CLI, FVM and Codemagic. Interviewers use it to gauge real Flutter depth.

on this pageshow

explore

→ has its own guide

questions

640 · 10 sections

In Flutter, why is calling setState from an AnimationController listener on every tick discouraged, and what replaces it?

level: juniorimportance: must knowfreq 52%
basics
~20 s

setState in a controller listener re-runs the State's whole build method every frame, rebuilding widgets that never change. AnimatedBuilder or a FooTransition widget scopes the rebuild to what depends on the animation, and FadeTransition avoids widget rebuilds altogether.

open as a page

In a Flutter StatefulWidget, how do you create, start, stop and dispose an AnimationController for a pulsing record button?

level: juniorimportance: must knowfreq 60%
basics
~20 s

Mix a ticker provider into the State, create the controller in initState with vsync: this and a duration, call repeat(reverse: true) while recording, stop or animate it back when recording ends, and dispose it in dispose before super.dispose().

open as a page

In Flutter, how does a Hero animation carry a widget between two routes, and what must the two Hero widgets share?

level: juniorimportance: must knowfreq 55%
basics
~20 s

The app's HeroController pairs Hero widgets with equal tags on the outgoing and incoming PageRoutes. During the route transition, the destination hero's child flies in the Navigator's overlay between their bounds while placeholders fill both original slots.

open as a page

In Flutter, how does AnimatedContainer animate a property change, and when do you need an AnimationController instead of an implicit widget?

level: juniorimportance: must knowfreq 65%
basics
~20 s

AnimatedContainer's State keeps its own AnimationController; when a rebuild passes a new property value it tweens from the current value to it over duration and curve. Loops, on-demand playback, gestures and shared timelines need an explicit controller.

open as a page

In Flutter's animation library, what does a Tween do, and how does Tween.animate() relate to Animation.drive()?

level: juniorimportance: must knowfreq 62%
basics
~10 s

A Tween is an Animatable that maps a 0.0-to-1.0 animation value onto a begin-to-end range of sizes, colors or offsets. tween.animate(controller) and controller.drive(tween) are the same operation written from opposite ends.

open as a page

With package:bloc, what is a Cubit, and how does it hold, change and publish its state?

level: juniorimportance: must knowfreq 74%
basics
~20 s

A Cubit is a bloc-package state holder: it starts from the value passed to super, changes only when its own methods call emit, exposes the current value through state and publishes each later change on a broadcast stream.

open as a page

With package:bloc, how does a Bloc turn an event passed to add into one or more new states?

level: juniorimportance: must knowfreq 70%
basics
~20 s

A Bloc receives event objects through add. Each event type has one handler registered with on<E> in the constructor; the handler gets the event and an Emitter and calls it zero or more times, often around an await, to produce new states.

open as a page

With the bloc_test package, how does blocTest drive a Bloc through build, act and expect, and why is the initial state missing from expect?

level: juniorimportance: must knowfreq 50%
basics
~20 s

blocTest builds a fresh bloc, subscribes to its state stream, runs act, closes the bloc and compares every state emitted after that against expect, in order. The constructor's initial state is never pushed to the stream, so it is never recorded.

open as a page

With flutter_bloc, how do BlocBuilder and BlocListener differ, and which one should show a login-failure dialog?

level: juniorimportance: must knowfreq 76%
basics
~20 s

BlocBuilder rebuilds part of the UI from the current state and may run its builder many times, so it must be pure. BlocListener runs a void callback once per state change, never for the initial state, so dialogs, snackbars and navigation belong there.

open as a page

With package:bloc, when is a Cubit enough, and what would make you choose an event-driven Bloc instead?

level: middleimportance: must knowfreq 68%
basics
~20 s

A Cubit is enough when state changes are direct method calls. Choose a Bloc when you need each change traced to the event that caused it, or need to transform incoming events, such as debouncing a search or dropping overlapping requests.

open as a page

In Riverpod 3, what is AsyncValue, and how do you render its loading, data and error states in a Flutter widget?

level: juniorimportance: must knowfreq 64%
basics
~10 s

AsyncValue is Riverpod's sealed result type for async providers: AsyncData, AsyncLoading or AsyncError. A widget watches the provider and switches over the AsyncValue - exhaustively, with no default - or calls when(data:, error:, loading:).

open as a page

In Riverpod 3 with riverpod_generator, what does annotating a function versus a Notifier class with @riverpod generate, and how is it named?

level: juniorimportance: must knowfreq 55%
basics
~20 s

An annotated function with a Ref first parameter becomes a read-only functional provider whose kind follows its return type; an annotated class extending _$Name with build() becomes a notifier provider. Names are lower camel case plus Provider, with a trailing Notifier stripped.

open as a page

In Riverpod 3, what does autoDispose do, and why does a product-detail screen refetch after you leave and reopen it?

level: juniorimportance: must knowfreq 55%
basics
~20 s

autoDispose destroys a provider's state once nothing listens to it any more. Leaving the product screen removes its last listener, so the state and fetched product are dropped; reopening reads the provider again, which rebuilds it and refetches.

open as a page

In Riverpod 3, which provider type fits a computed value, a one-off async load, a live stream, and state the UI changes?

level: juniorimportance: must knowfreq 60%
basics
~10 s

Provider for a synchronous computed or injected value, FutureProvider for data loaded once, StreamProvider for values that keep arriving, and NotifierProvider or AsyncNotifierProvider when the UI must change the state through methods.

open as a page

In Riverpod 3, what is the difference between ref.watch, ref.read and ref.listen, and where does each one belong?

level: juniorimportance: must knowfreq 78%
basics
~20 s

ref.watch returns a provider's value and subscribes, so the widget or provider rebuilds on change; ref.read returns the current value once with no subscription, for event handlers; ref.listen runs a callback on change for side effects like a snackbar.

open as a page

With the provider package, what is the difference between context.watch, context.read and context.select, and when do you use each?

level: juniorimportance: must knowfreq 72%
basics
~10 s

context.watch<T>() returns the nearest provided T and rebuilds the widget when it notifies; context.read<T>() returns it without subscribing, for callbacks; context.select rebuilds only when the value its selector derives changes.

open as a page

With the provider package, which widgets can read a provider, and how do you decide where to place ChangeNotifierProvider in the tree?

level: juniorimportance: must knowfreq 62%
basics
~20 s

Only descendants of a provider widget can read it, and the nearest provider of the requested type wins. Place ChangeNotifierProvider at the lowest common ancestor of every widget and route that reads it, no higher than its state should live.

open as a page

In Flutter's provider package, which provider class fits a plain object, a ChangeNotifier, a Future and a Stream, and why?

level: juniorimportance: must knowfreq 55%
basics
~10 s

Provider exposes a plain value without listening; ChangeNotifierProvider listens to a ChangeNotifier and disposes it; ListenableProvider and ValueListenableProvider cover other listenables; FutureProvider and StreamProvider expose an async result, starting from a required initialData.

open as a page

With the provider package, why does context.watch fail inside onPressed or initState, and what should those call sites use instead?

level: middleimportance: must knowfreq 58%
basics
~20 s

context.watch subscribes the widget, which is only meaningful during build: in onPressed provider's debug assertion rejects listening, and in initState Flutter rejects the dependency. Use context.read, or Provider.of with listen: false, at both call sites.

open as a page

With Flutter's provider package, when do you use a provider's create constructor versus its .value constructor, and what breaks when they are swapped?

level: middleimportance: must knowfreq 50%
basics
~20 s

Use create when the provider builds and owns the object, .value when it exposes an instance owned elsewhere. A new object inside .value is recreated on every rebuild; an existing instance passed to create gets disposed while still in use.

open as a page

In GetX, how do .obs values and the Obx widget make a Flutter widget rebuild, and what must the Obx builder do?

level: juniorimportance: must knowfreq 55%
basics
~20 s

Calling .obs wraps a value in an Rx type such as RxInt. Obx records every Rx whose value its builder reads while running and rebuilds when one changes; a builder that reads no observable throws GetX's 'improper use' error.

open as a page

In GetX, how do Get.put, Get.lazyPut and Bindings differ, and when do a GetxController's onInit, onReady and onClose run?

level: middleimportance: must knowfreq 45%
basics
~20 s

Get.put registers and starts an instance immediately; Get.lazyPut registers a builder that runs on the first Get.find. Bindings group those calls per route. onInit runs when the instance starts, onReady one frame later, onClose when it is deleted.

open as a page

In GetX, how do Get.to, Get.toNamed and Get.snackbar work without a BuildContext, and what do they require?

level: middleimportance: should knowfreq 38%
basics
~10 s

GetMaterialApp owns a global navigator key, so Get.to, Get.toNamed and Get.back push and pop on it from anywhere, and Get.snackbar inserts entries into that navigator's overlay. Without GetMaterialApp or Get.key, these calls throw.

open as a page

In GetX, how does GetBuilder with update() differ from Obx with .obs values, and when would you choose each?

level: middleimportance: should knowfreq 40%
basics
~20 s

GetBuilder rebuilds when the controller calls update(), optionally only builders with a given id, and works with plain fields. Obx rebuilds automatically when an Rx value read in its builder changes. GetBuilder is explicit and cheaper; Obx is less code.

open as a page

A small Flutter prototype built with GetX now needs a test suite for a growing team; what makes its controllers and screens hard to test, and how do you fix that?

level: seniorimportance: should knowfreq 32%
basics
~20 s

GetX state lives in one global registry, so tests leak instances, Get.find hides dependencies and navigating controllers need a navigator. Call Get.reset() in tearDown, register fakes first, inject dependencies by constructor and move navigation behind an interface.

open as a page

In RxDart, what does a new listener receive from a BehaviorSubject, a PublishSubject and a ReplaySubject, and which suits UI state?

level: juniorimportance: must knowfreq 55%
basics
~20 s

A late BehaviorSubject listener first gets the latest value (or error), a PublishSubject listener gets only later events, and a ReplaySubject listener gets the buffered history, capped by maxSize. BehaviorSubject suits UI state: late listeners see the current value.

open as a page

In RxDart, how do switchMap, exhaustMap and flatMap differ, and which fits a search box, a submit button and parallel poster downloads?

level: middleimportance: must knowfreq 50%
basics
~20 s

switchMap cancels the running inner stream when a new event arrives, exhaustMap ignores new events until the running one completes, and flatMap runs them all concurrently, optionally capped by maxConcurrent. Search wants switchMap, a submit button exhaustMap, parallel downloads flatMap.

open as a page

In a Flutter app, when do Dart's core Stream methods suffice, and which RxDart operators have no core Stream equivalent?

level: juniorimportance: should knowfreq 36%
basics
~20 s

Core Stream already maps, filters, de-duplicates and runs async work in order (map, where, distinct, asyncMap, asyncExpand). RxDart earns its dependency for timing (debounceTime, throttleTime), cancel-or-ignore flattening (switchMap, exhaustMap, flatMap) and combining sources (combineLatest2, zip2, merge, withLatestFrom).

open as a page

In RxDart, what do throttleTime's leading and trailing defaults do, and why would a throttled movie search miss the final query?

level: middleimportance: should knowfreq 34%
basics
~20 s

throttleTime defaults to leading: true and trailing: false: it emits the first event, then drops everything else for the duration. Typing "dune" quickly searches for "d" and never for "dune"; search needs debounceTime or trailing: true.

open as a page

In a Flutter app using redux and flutter_redux, what are the Store, a reducer and StoreProvider, and how does a dispatched action reach a widget?

level: juniorimportance: must knowfreq 38%
basics
~20 s

The Store holds all app state and is built from a reducer, an initialState and middleware; a reducer maps state and action to the next state. StoreProvider exposes the Store; after a dispatch the Store emits onChange and connected widgets rebuild.

open as a page

In flutter_redux, what does StoreConnector's converter do, and why must the view model implement == when distinct is true?

level: middleimportance: must knowfreq 34%
basics
~20 s

The converter maps the Store to a small view model and runs on every store change. With distinct: true, StoreConnector rebuilds only when the new view model != the previous one, so the view model needs value equality.

open as a page

Why is flutter_redux uncommon in current Flutter codebases, and what would you check before extending a legacy point-of-sale app built on it?

level: seniorimportance: should knowfreq 22%
basics
~10 s

flutter_redux needs one global store, a converter and value-equal view model per widget, dynamic actions and extra middleware for async work. Before extending a legacy app, check the package version, rebuild cost and conventions.

open as a page

In a Flutter redux app, how do you run async work such as a card-payment call through middleware, and what does a thunk middleware change?

level: seniorimportance: should knowfreq 30%
basics
~20 s

Middleware sees each action before the reducer: on a charge action it calls next(action), starts the payment future and later dispatches a success or failure action. A thunk middleware lets you dispatch a function that receives the store.

open as a page

In flutter_redux, when do StoreConnector's onInit, onWillChange, onDidChange and onInitialBuild run, and which one should trigger navigation?

level: middleimportance: nice to knowfreq 20%
basics
~20 s

onInit runs in initState before the first view model is built, onWillChange runs on a change before the rebuild, onDidChange and onInitialBuild run after the frame via post-frame callbacks, and onDispose runs in dispose. Navigation belongs in onWillChange.

open as a page

With flutter create, how do you start an app for Android, iOS and web only, and what do --org and --platforms control?

level: juniorimportance: must knowfreq 62%
basics
~10 s

Run flutter create --org com.acme --platforms android,ios,web shop_app. --org sets the reverse-domain prefix of the Android application ID and iOS bundle ID; --platforms decides which platform folders are generated.

open as a page

In Flutter, how do flutter devices, flutter emulators and flutter run -d work together to run an app on a chosen device?

level: juniorimportance: must knowfreq 58%
basics
~10 s

flutter devices lists connected devices with their ids, flutter emulators --launch starts an emulator or simulator, and flutter run -d <id or name prefix> runs on that device; -d all targets every device.

open as a page

In Flutter, what does the flutter doctor command check, and how do you read its markers and the extra detail flutter doctor -v adds?

level: juniorimportance: must knowfreq 72%
basics
~20 s

flutter doctor runs validators for the Flutter SDK, each host toolchain, connected devices and network access, marking each [✓] ready, [!] partial or [✗] missing with a fix hint; -v adds paths, revisions and timings.

open as a page

How do you install the Flutter SDK so flutter and dart work in any terminal, and what does flutter doctor flag when PATH is wrong?

level: juniorimportance: should knowfreq 40%
basics
~10 s

Extract the Flutter SDK to a user-writable folder and put its bin directory on PATH, which provides both flutter and dart. Doctor warns when either is missing from PATH or resolves outside that SDK.

open as a page

What does flutter clean delete in a Flutter project, and when does it fix a build rather than just slow the next one?

level: middleimportance: should knowfreq 48%
basics
~20 s

flutter clean deletes the project's build/ and .dart_tool/ directories, platform ephemeral folders and generated files, and cleans the Xcode workspace. It helps when stale generated state survives an SDK, plugin or config change; otherwise it only forces a slower full rebuild.

open as a page

With two client Flutter apps needing different SDK versions on one laptop, how does FVM keep each project on its own version?

level: juniorimportance: must knowfreq 55%
basics
~20 s

FVM keeps several Flutter SDKs in a shared cache and records each project's version in a committed .fvmrc file; fvm flutter and fvm dart then run the SDK that project pins, so the two apps never share one global Flutter.

open as a page

In FVM, how do fvm use and fvm global differ, and which SDK does fvm flutter pick when both are set?

level: middleimportance: must knowfreq 45%
basics
~20 s

fvm use pins a version for one project in .fvmrc; fvm global sets a machine-wide default link. fvm flutter uses the nearest project pin first, then the global version, then whatever flutter is on PATH.

open as a page

In an FVM project, what do .fvmrc and .fvm/ contain, and how do you point VS Code and Android Studio at the pinned SDK?

level: middleimportance: should knowfreq 38%
basics
~20 s

.fvmrc is committed JSON holding the pinned flutter version, optional flavors and per-project switches; .fvm/ holds local links into the FVM cache. VS Code's dart.flutterSdkPath is set by FVM; Android Studio is pointed at .fvm/flutter_sdk manually.

open as a page

How do you use FVM so CI builds a Flutter app with exactly the SDK version developers pin, including in a repository with several apps?

level: seniorimportance: should knowfreq 34%
basics
~20 s

Commit an exact version in .fvmrc, then in CI install FVM, run fvm install with no argument to fetch the pinned SDK, and run every step through fvm flutter. In a multi-app repository, each app resolves the nearest .fvmrc.

open as a page

In FVM, how do fvm spawn, fvm flavor and fvm exec differ from fvm flutter, and when would you use each?

level: middleimportance: nice to knowfreq 20%
basics
~20 s

fvm flutter runs the pinned SDK; fvm spawn <version> runs one command on another version with the pin unchanged; fvm flavor <name> uses a version named in .fvmrc; fvm exec runs any command with the pinned SDK on PATH.

open as a page

In Codemagic, what is a workflow in codemagic.yaml, and which sections does a typical Flutter release workflow define?

level: juniorimportance: must knowfreq 48%
basics
~20 s

A Codemagic workflow is one named pipeline under the workflows key of codemagic.yaml, committed at the repository root. It declares its machine, environment, triggers, scripts, artifacts and publishing, so one file can hold separate test and release workflows.

open as a page

In codemagic.yaml, how does ios_signing, backed by an App Store Connect API key, let Codemagic sign a Flutter iOS build automatically?

level: middleimportance: must knowfreq 52%
basics
~20 s

An App Store Connect API key (Issuer ID, Key ID, .p8 file) lets Codemagic create certificates and fetch provisioning profiles into Code signing identities. ios_signing with distribution_type and bundle_identifier installs the matching files at build time, and xcode-project use-profiles applies them.

open as a page

In Codemagic, what are environment variable groups, and how should a codemagic.yaml workflow receive secrets such as a Google Play service-account key?

level: middleimportance: should knowfreq 40%
basics
~20 s

Codemagic environment variable groups are named sets of variables defined in team or application settings, marked Secret to encrypt them, and imported by name under environment.groups. Binary files are base64-encoded before storing and decoded during the build.

open as a page

In codemagic.yaml, how do you make a Codemagic workflow build automatically on pull requests into main and on release tags, and skip stale builds?

level: middleimportance: should knowfreq 36%
basics
~20 s

Codemagic starts a workflow from its triggering section: events such as push, pull_request or tag, filtered by branch_patterns and tag_patterns and delivered by a repository webhook. cancel_previous_builds and a when block drop stale or irrelevant builds.

open as a page

For a scooter-sharing Flutter app, how would you set up Codemagic so a version tag signs both platforms and ships builds to Google Play internal testing and TestFlight?

level: seniorimportance: should knowfreq 34%
basics
~20 s

Use two tag-triggered workflows sharing anchors: Android with android_signing, a store-derived build number and google_play publishing to the internal track; iOS with ios_signing app_store, use-profiles and app_store_connect publishing via the API-key integration. The first Play upload is manual; App Store Connect needs an app record.

open as a page