Skip to content

Commit 556c44c

Browse files
authored
[material_ui] Add awaitNotRequired annotation to material_ui (flutter#12622)
material_ui split of [Add awaitNotRequired annotation to Material/Cupertino libraries](flutter#185446) Part of [Use @awaitNotRequired in Flutter SDK](flutter#168555)
1 parent cde74b6 commit 556c44c

7 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎packages/material_ui/lib/src/bottom_sheet.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,7 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> {
13011301
/// * The Material 3 spec at <https://m3.material.io/components/bottom-sheets/overview>.
13021302
/// * [AnimationStyle], which is used to override the modal bottom sheet
13031303
/// animation duration and reverse animation duration.
1304+
@awaitNotRequired
13041305
Future<T?> showModalBottomSheet<T>({
13051306
required BuildContext context,
13061307
required WidgetBuilder builder,

‎packages/material_ui/lib/src/carousel.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,6 +1979,7 @@ class CarouselController extends ScrollController {
19791979
/// direction.
19801980
///
19811981
/// Does nothing if the carousel is not attached to this controller.
1982+
@awaitNotRequired
19821983
Future<void> animateToItem(
19831984
int index, {
19841985
Duration duration = const Duration(milliseconds: 300),

‎packages/material_ui/lib/src/date_picker.dart‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ library;
1010

1111
import 'dart:math' as math;
1212

13+
import 'package:flutter/foundation.dart';
1314
import 'package:flutter/rendering.dart';
1415
import 'package:flutter/services.dart';
1516
import 'package:flutter/widgets.dart';
@@ -205,6 +206,7 @@ const double _fontSizeToScale = 14.0;
205206
/// * [DisplayFeatureSubScreen], which documents the specifics of how
206207
/// [DisplayFeature]s can split the screen into sub-screens.
207208
/// * [showTimePicker], which shows a dialog that contains a Material Design time picker.
209+
@awaitNotRequired
208210
Future<DateTime?> showDatePicker({
209211
required BuildContext context,
210212
DateTime? initialDate,
@@ -1180,6 +1182,7 @@ typedef SelectableDayForRangePredicate =
11801182
/// * [DateTimeRange], which is used to describe a date range.
11811183
/// * [DisplayFeatureSubScreen], which documents the specifics of how
11821184
/// [DisplayFeature]s can split the screen into sub-screens.
1185+
@awaitNotRequired
11831186
Future<DateTimeRange?> showDateRangePicker({
11841187
required BuildContext context,
11851188
DateTimeRange? initialDateRange,

‎packages/material_ui/lib/src/dialog.dart‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,7 @@ class _DialogContentPage extends Page<void> {
16691669
/// [DisplayFeature]s can split the screen into sub-screens.
16701670
/// * <https://material.io/design/components/dialogs.html>
16711671
/// * <https://m3.material.io/components/dialogs>
1672+
@awaitNotRequired
16721673
Future<T?> showDialog<T>({
16731674
required BuildContext context,
16741675
required WidgetBuilder builder,
@@ -1754,6 +1755,7 @@ Future<T?> showDialog<T>({
17541755
///
17551756
/// On Cupertino platforms, [barrierColor], [useSafeArea], and
17561757
/// [traversalEdgeBehavior] are ignored.
1758+
@awaitNotRequired
17571759
Future<T?> showAdaptiveDialog<T>({
17581760
required BuildContext context,
17591761
required WidgetBuilder builder,

‎packages/material_ui/lib/src/popup_menu.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,7 @@ typedef PopupMenuPositionBuilder =
11731173
/// calling this method automatically.
11741174
/// * [SemanticsConfiguration.namesRoute], for a description of edge triggered
11751175
/// semantics.
1176+
@awaitNotRequired
11761177
Future<T?> showMenu<T>({
11771178
required BuildContext context,
11781179
RelativeRect? position,

‎packages/material_ui/lib/src/time_picker.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3266,6 +3266,7 @@ class _TimePickerState extends State<_TimePicker> with RestorationMixin {
32663266
/// typography, and shape of the time picker.
32673267
/// * [DisplayFeatureSubScreen], which documents the specifics of how
32683268
/// [DisplayFeature]s can split the screen into sub-screens.
3269+
@awaitNotRequired
32693270
Future<TimeOfDay?> showTimePicker({
32703271
required BuildContext context,
32713272
required TimeOfDay initialTime,
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
changelog: |
2+
- Adds `@awaitNotRequired` annotations to asynchronous functions that do not need to be awaited.
3+
version: patch

0 commit comments

Comments
 (0)