Start Debugging

how-to

78 posts · Page 1 of 8

2026-10-25 flutterdartios

How to Lock Screen Orientation for a Single Screen in Flutter (and Why iPad Multitasking Ignores It)

Lock one Flutter route to landscape or portrait with SystemChrome.setPreferredOrientations without breaking the rest of the app: a stack-based lock that survives pushReplacement and restores on pop, why the empty list is the wrong reset, why iPad multitasking and Android 16 large screens ignore the lock, and what UIRequiresFullScreen means after iPadOS 26 and the iOS 27 SDK. Tested on Flutter 3.47.8 with Dart 3.13.7 and Xcode 27.1.

How to mark a controller action's response as nullable in ASP.NET Core's built-in OpenAPI document

Microsoft.AspNetCore.OpenApi only marks a response nullable when the action returns a bare T? (and, on .NET 10, not even Task<T?>). ActionResult<T?> and IActionResult lose the annotation on both .NET 10 and .NET 11 RC2. Here is why, a tested operation transformer that fixes it, and the 204 No Content trap that makes the spec lie unless you also change MVC's formatter.
2026-10-19 flutterdarttheming

How to Define Custom Design Tokens with ThemeExtension and Animate Them Between Light and Dark Themes in Flutter

Subclass ThemeExtension, register one instance per ThemeData through the extensions list, read it with Theme.of(context).extension<T>(), and write a real lerp so MaterialApp's AnimatedTheme interpolates your tokens during a light/dark switch. Covers colors, radii, shadows, text styles and booleans, the missing-extension crash, the copyWith trap that drops every other extension, and why you need == and hashCode, all verified with widget tests on Flutter 3.44.8.

How to Make AnimatedSwitcher Animate When the Child Widget Type Does Not Change in Flutter

AnimatedSwitcher only transitions when Widget.canUpdate says the new child is a different widget, so Text to Text with no key just updates in place. Here is the one-line fix, where the key has to sit, why UniqueKey is a trap, the slide-direction bug caused by a static transitionBuilder, and the layout jump from the default Stack, all verified with widget tests on Flutter 3.44.8.
2026-10-19 flutterdartandroid

How to Restore UI State After Android Process Death in Flutter with RestorationMixin

Android kills backgrounded Flutter apps to reclaim memory, and when the user comes back every StatefulWidget starts from scratch. Here is how to opt in with restorationScopeId, RestorationMixin and Restorable properties, restore text fields, scroll offsets and pushed routes, write a custom RestorableValue, and test it all with restartAndRestore and adb, verified on Flutter 3.44.8 and an Android 16 emulator.
Next