File tree 1 file changed +6
-2
lines changed 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -604,7 +604,9 @@ class _Future<T> implements Future<T> {
604
604
/// succeed by the way the function is called.
605
605
/// Should be used judiciously.
606
606
void _asyncCompleteUnchecked (/*FutureOr<T>*/ dynamic value) {
607
- assert ((value as FutureOr <T >) == value);
607
+ // Ensure [value] is FutureOr<T>, do so using an `as` check so it works
608
+ // also correctly in non-sound null-safety mode.
609
+ assert (identical (value as FutureOr <T >, value));
608
610
final typedValue = unsafeCast <FutureOr <T >>(value);
609
611
610
612
// Doing just "is Future" is not sufficient.
@@ -625,7 +627,9 @@ class _Future<T> implements Future<T> {
625
627
/// [Future] .
626
628
/// Should be used judiciously.
627
629
void _asyncCompleteUncheckedNoFuture (/*T*/ dynamic value) {
628
- assert ((value as T ) == value);
630
+ // Ensure [value] is T, do so using an `as` check so it works also correctly
631
+ // in non-sound null-safety mode.
632
+ assert (identical (value as T , value));
629
633
_asyncCompleteWithValue (unsafeCast <T >(value));
630
634
}
631
635
You can’t perform that action at this time.
0 commit comments