Repository navigation
Description
Steps to reproduce
- Run the sample below on iOS or Android with the device set to 12-hour time.
- With the app still running, switch the device to 24-hour time in Settings.
- Return to the app.
Expected results
MediaQuery.alwaysUse24HourFormatOf(context) reflects the platform's current setting (as PlatformDispatcher.alwaysUse24HourFormat does), so the sample reads 24-hour, and TimeOfDay.format / showTimePicker switch to the 24-hour clock.
Actual results
MediaQuery keeps the previous value until one of metrics, text scale, platform brightness or accessibility features changes, or the app restarts, so every MediaQuery-driven time format stays on the old clock.
I have reproduced this deterministically with the widget test below, which drives the same framework path the engine does on this change; I have not captured it on a physical device.
Code sample
App
import 'package:flutter/material.dart';
void main() => runApp(const MaterialApp(home: Probe()));
class Probe extends StatelessWidget {
const Probe({super.key});
@override
Widget build(BuildContext context) => Scaffold(
body: Center(
child: Text(MediaQuery.alwaysUse24HourFormatOf(context)
? '24-hour'
: '12-hour'),
),
);
}Widget test (fails on 3.44.6)
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('MediaQuery sees a 24-hour change', (tester) async {
addTearDown(tester.platformDispatcher.clearAlwaysUse24HourTestValue);
await tester.pumpWidget(MaterialApp(
home: Builder(
builder: (context) =>
Text('${MediaQuery.alwaysUse24HourFormatOf(context)}'),
),
));
expect(find.text('false'), findsOneWidget);
// What the engine does when only this setting changes: update the value
// and invoke onPlatformConfigurationChanged.
tester.platformDispatcher.alwaysUse24HourFormatTestValue = true;
tester.platformDispatcher.onPlatformConfigurationChanged?.call();
await tester.pump();
expect(find.text('true'), findsOneWidget); // fails: still 'false'
});
}Analysis (3.44.6)
dart:uiPlatformDispatcher._updateUserSettingsData: when onlyalwaysUse24HourFormatchanges, it updates the configuration and invokesonPlatformConfigurationChanged;onTextScaleFactorChanged,onPlatformBrightnessChangedandonSystemFontFamilyChangedare each gated on their own value changing.- Nothing in
packages/flutter/liblistens toonPlatformConfigurationChanged. _MediaQueryFromViewState(widgets/media_query.dart) re-readsMediaQueryData.fromViewonly fromdidChangeDependencies,didChangeMetrics,didChangeTextScaleFactor,didChangePlatformBrightnessanddidChangeAccessibilityFeatures.- Related, in
flutter_test: theTestPlatformDispatcher.alwaysUse24HourFormatTestValuesetter only stores the value (unliketextScaleFactorTestValue, which callsonTextScaleFactorChanged), so a test cannot observe a change without invoking a callback itself.
Workaround
Re-provide MediaQuery from a widget below MaterialApp (its builder:) that listens to onPlatformConfigurationChanged, chaining any existing handler, and overrides alwaysUse24HourFormat with PlatformDispatcher.alwaysUse24HourFormat.
Flutter Doctor output
Flutter 3.44.6 • channel stable
Activity
saurabh-mirajkar commentedon Oct 19, 2026
@ericchoi35 Thanks for the report. I reproduced this on Flutter 3.47.7 stable using the supplied test and on a physical Pixel 6 (Android 17). @sreevishnuqa also reproduced it on a physical iPhone (iOS 27.2) where the updated format appeared only after opening the app a second time.
Labelling this and routing it to the framework team for further investigation.
Related: #149179
android-date.mp4
ios-date.mov
Refresh MediaQuery.alwaysUse24HourFormat when platform configuration …
Refresh MediaQuery.alwaysUse24HourFormat when platform configuration …
Renzo-Olivares commentedon Oct 20, 2026
Thank you for the report @ericchoi35! Looks like @prasad2512 has a PR in progress that will fix this.
Refresh MediaQuery.alwaysUse24HourFormat when platform configuration …
Add PlatformDispatcher.onAlwaysUse24HourFormatChanged callback (flutt…