Skip to content
tezvyn:

All bites

The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.

4330 bites

Page 10

Flutter & Dart2 min read

Explain Flutter's GestureArena and overlapping detector scenario

The arena opens on pointer down; recognizers accept or reject; the last accepted member wins.

Flutter & Dart2 min read

How do you pass data with Navigator.push and return data with Navigator.pop?

Tests imperative navigation and async result patterns. Strong answer: push via MaterialPageRoute with constructor args; await the Future from Navigator.push; pop with Navigator.pop(context, result). Red flag: using global state instead of the Future result.

Flutter & Dart2 min read

Navigator.push vs Navigator.pushNamed in Flutter

Tests Flutter navigation patterns and scalability. A strong answer contrasts inline widget construction with centralized route tables, noting pushNamed centralizes routes but complicates type-safe data. Red flag: named routes are always better for large apps.

Flutter & Dart2 min read

Explain the core responsibilities of RouterDelegate, RouteInformationParser, and Router in Flutter

Tests Navigator 2.0 architecture split. RouteInformationParser converts URLs to typed config; RouterDelegate owns state and builds the Navigator; Router wires them together and handles engine intents. Red flag: conflating parsing and state or omitting Router.

Flutter & Dart2 min read

Implement a GoRouter path parameter route and access userId in a widget

This tests GoRouter declarative routing and GoRouterState. Define a GoRoute with path '/users/:userId', read state.params['userId'] in the builder, and handle null-safety. A red flag is parsing the URI manually or using ModalRoute.of instead of state.params.

Flutter & Dart1 min read

Per-tab navigation stacks with StatefulShellRoute

StatefulShellRoute keeps a separate Navigator and preserved state per branch, with a shared shell scaffold.

Flutter & Dart2 min read

Custom fade-and-scale transition with PageRouteBuilder and GoRoute

Tests bridging imperative transitions to declarative routers. Use PageRouteBuilder with FadeTransition and ScaleTransition, set globally in theme or per route via GoRoute pageBuilder with CustomTransitionPage. Red flag: omitting child rebuilds the page.

Flutter & Dart2 min read

Explain ephemeral vs app state and when to use setState

This tests state scoping judgment. Ephemeral state is local to one widget, like a page index or checkbox value, and setState fits perfectly. App state is shared, like a user profile or cart, and needs a state management solution.

Flutter & Dart1 min read

Provider package versus raw InheritedWidget

It removes boilerplate, adds lifecycle disposal and scoped reads, and exposes select for granular rebuilds.

Flutter & Dart2 min read

Difference between context.watch, context.read, and Selector in Provider and Riverpod

Tests rebuild granularity in Flutter. A strong answer distinguishes listening versus one-time lookup, explains that Selector filters rebuilds by comparing sub-values, and warns that context.read inside build causes missed updates.

Flutter & Dart2 min read

How do you manage product list and favorite state without full rebuilds?

This tests granular rebuild control in Flutter lists. A strong answer isolates item state with ValueNotifier or ChangeNotifier per item plus const constructors with keys. Red flag: calling setState on the parent list rebuilds every ListTile on each tap.

Flutter & Dart2 min read

Explain lifting state up in Flutter and how Provider simplifies it

Tests declarative state ownership and prop-drilling cost. A strong answer names the lowest common ancestor, contrasts callback threading with Provider lookup, and avoids root-level state.

Flutter & Dart1 min read

Immutable bloc state versus mutable ChangeNotifier

Immutable gives predictable diffs, easy debugging and replayability at the cost of boilerplate; mutable is terse but error-prone.

Flutter & Dart2 min read

Make a GET request with http and parse JSON in Dart

Practical Dart async networking with package:http and dart:convert. Import http, await get(Uri.parse(url)), verify statusCode is 200, then jsonDecode(response.body) as List<Map<String, dynamic>>. Skipping status checks or decoding without a cast.

Flutter & Dart2 min read

Explain FutureBuilder and how it manages async UI states

This tests declarative async UI state management. Obtain the Future before build, pass it to FutureBuilder, and branch on snapshot.connectionState and hasError to render loading, data, or error states.

Flutter & Dart2 min read

Purpose of factory fromJson constructor in Dart models

Factory fromJson centralizes deserialization, preprocesses Map values before instantiation, and keeps the primary constructor clean.

Flutter & Dart2 min read

Describe a robust error handling strategy for network requests

Tests whether you classify failures by layer rather than catching everything generically. Inspect DioExceptionType for connectivity, check HTTP status before parsing, and isolate JSON decode errors. Never show the same message for timeouts and 500s.

Flutter & Dart2 min read

Compare manual JSON serialization versus json_serializable

It tests build automation versus manual control in Dart serialization. Manual methods avoid build steps but risk drift; code generation cuts boilerplate but adds compile latency. Claiming code gen slows runtime or that manual is always simpler.

Flutter & Dart2 min read

How would you manage network request state in a Flutter widget?

This tests whether you separate ephemeral widget state from business logic. A good answer defines a state class, uses setState in initState, then shows how a library moves logic out for testing and reuse. Red flag: fetch inside build or using boolean flags.

Flutter & Dart2 min read

Explain Dio interceptors and automatic token refresh

Define interceptors as hooks; queue concurrent 401s during refresh; retry with Bearer header via token manager.