Unverified Commit 7272c809 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Remove unnecessary null checks in `flutter/{animation,semantics,scheduler}` (#118922)

* Remove unnecessary null checks in flutter/animation

* Remove unnecessary null checks in flutter/semantics

* Remove unnecessary null checks in flutter/scheduler
parent 5d74b5cb
......@@ -269,7 +269,6 @@ abstract class Animation<T> extends Listenable implements ValueListenable<T> {
/// * "&#x23ED;": [AnimationStatus.completed] ([value] == 1.0)
/// * "&#x23EE;": [AnimationStatus.dismissed] ([value] == 0.0)
String toStringDetails() {
assert(status != null);
switch (status) {
case AnimationStatus.forward:
return '\u25B6'; // >
......
......@@ -242,10 +242,7 @@ class AnimationController extends Animation<double>
this.upperBound = 1.0,
this.animationBehavior = AnimationBehavior.normal,
required TickerProvider vsync,
}) : assert(lowerBound != null),
assert(upperBound != null),
assert(upperBound >= lowerBound),
assert(vsync != null),
}) : assert(upperBound >= lowerBound),
_direction = _AnimationDirection.forward {
_ticker = vsync.createTicker(_tick);
_internalSetValue(value ?? lowerBound);
......@@ -275,9 +272,7 @@ class AnimationController extends Animation<double>
this.debugLabel,
required TickerProvider vsync,
this.animationBehavior = AnimationBehavior.preserve,
}) : assert(value != null),
assert(vsync != null),
lowerBound = double.negativeInfinity,
}) : lowerBound = double.negativeInfinity,
upperBound = double.infinity,
_direction = _AnimationDirection.forward {
_ticker = vsync.createTicker(_tick);
......@@ -363,7 +358,6 @@ class AnimationController extends Animation<double>
/// * [forward], [reverse], [animateTo], [animateWith], [fling], and [repeat],
/// which start the animation controller.
set value(double newValue) {
assert(newValue != null);
stop();
_internalSetValue(newValue);
notifyListeners();
......@@ -657,7 +651,6 @@ class AnimationController extends Animation<double>
}());
assert(max >= min);
assert(max <= upperBound && min >= lowerBound);
assert(reverse != null);
stop();
return _startSimulation(_RepeatingSimulation(_value, min, max, reverse, period!, _directionSetter));
}
......@@ -744,7 +737,6 @@ class AnimationController extends Animation<double>
}
TickerFuture _startSimulation(Simulation simulation) {
assert(simulation != null);
assert(!isAnimating);
_simulation = simulation;
_lastElapsedDuration = Duration.zero;
......@@ -856,9 +848,7 @@ class AnimationController extends Animation<double>
class _InterpolationSimulation extends Simulation {
_InterpolationSimulation(this._begin, this._end, Duration duration, this._curve, double scale)
: assert(_begin != null),
assert(_end != null),
assert(duration != null && duration.inMicroseconds > 0),
: assert(duration.inMicroseconds > 0),
_durationInSeconds = (duration.inMicroseconds * scale) / Duration.microsecondsPerSecond;
final double _durationInSeconds;
......
......@@ -271,8 +271,7 @@ class ReverseAnimation extends Animation<double>
/// Creates a reverse animation.
///
/// The parent argument must not be null.
ReverseAnimation(this.parent)
: assert(parent != null);
ReverseAnimation(this.parent);
/// The animation whose value and direction this animation is reversing.
final Animation<double> parent;
......@@ -310,7 +309,6 @@ class ReverseAnimation extends Animation<double>
double get value => 1.0 - parent.value;
AnimationStatus _reverseStatus(AnimationStatus status) {
assert(status != null);
switch (status) {
case AnimationStatus.forward: return AnimationStatus.reverse;
case AnimationStatus.reverse: return AnimationStatus.forward;
......@@ -384,8 +382,7 @@ class CurvedAnimation extends Animation<double> with AnimationWithParentMixin<do
required this.parent,
required this.curve,
this.reverseCurve,
}) : assert(parent != null),
assert(curve != null) {
}) {
_updateCurveDirection(parent.status);
parent.addStatusListener(_updateCurveDirection);
}
......@@ -518,7 +515,7 @@ class TrainHoppingAnimation extends Animation<double>
Animation<double> this._currentTrain,
this._nextTrain, {
this.onSwitchedTrain,
}) : assert(_currentTrain != null) {
}) {
if (_nextTrain != null) {
if (_currentTrain!.value == _nextTrain!.value) {
_currentTrain = _nextTrain;
......@@ -644,8 +641,7 @@ abstract class CompoundAnimation<T> extends Animation<T>
CompoundAnimation({
required this.first,
required this.next,
}) : assert(first != null),
assert(next != null);
});
/// The first sub-animation. Its status takes precedence if neither are
/// animating.
......
......@@ -35,7 +35,6 @@ abstract class ParametricCurve<T> {
/// implementation of [transform], which delegates the remaining logic to
/// [transformInternal].
T transform(double t) {
assert(t != null);
assert(t >= 0.0 && t <= 1.0, 'parametric value $t is outside of [0, 1] range.');
return transformInternal(t);
}
......@@ -129,7 +128,7 @@ class SawTooth extends Curve {
/// Creates a sawtooth curve.
///
/// The [count] argument must not be null.
const SawTooth(this.count) : assert(count != null);
const SawTooth(this.count);
/// The number of repetitions of the sawtooth pattern in the unit interval.
final int count;
......@@ -159,10 +158,7 @@ class Interval extends Curve {
/// Creates an interval curve.
///
/// The arguments must not be null.
const Interval(this.begin, this.end, { this.curve = Curves.linear })
: assert(begin != null),
assert(end != null),
assert(curve != null);
const Interval(this.begin, this.end, { this.curve = Curves.linear });
/// The largest value for which this interval is 0.0.
///
......@@ -207,7 +203,7 @@ class Threshold extends Curve {
/// Creates a threshold curve.
///
/// The [threshold] argument must not be null.
const Threshold(this.threshold) : assert(threshold != null);
const Threshold(this.threshold);
/// The value before which the curve is 0.0 and after which the curve is 1.0.
///
......@@ -307,11 +303,7 @@ class Cubic extends Curve {
/// cubic curves in [Curves].
///
/// The [a] (x1), [b] (y1), [c] (x2) and [d] (y2) arguments must not be null.
const Cubic(this.a, this.b, this.c, this.d)
: assert(a != null),
assert(b != null),
assert(c != null),
assert(d != null);
const Cubic(this.a, this.b, this.c, this.d);
/// The x coordinate of the first control point.
///
......@@ -518,9 +510,6 @@ abstract class Curve2D extends ParametricCurve<Offset> {
// 4. Recursively sample the two parts.
//
// This algorithm concentrates samples in areas of high curvature.
assert(tolerance != null);
assert(start != null);
assert(end != null);
assert(end > start);
// We want to pick a random seed that will keep the result stable if
// evaluated again, so we use the first non-generated control point.
......@@ -577,7 +566,6 @@ abstract class Curve2D extends ParametricCurve<Offset> {
/// single-valued, it will return the parameter for only one of the values at
/// the given `x` location.
double findInverse(double x) {
assert(x != null);
double start = 0.0;
double end = 1.0;
late double mid;
......@@ -612,7 +600,7 @@ class Curve2DSample {
/// Creates an object that holds a sample; used with [Curve2D] subclasses.
///
/// All arguments must not be null.
const Curve2DSample(this.t, this.value) : assert(t != null), assert(value != null);
const Curve2DSample(this.t, this.value);
/// The parametric location of this sample point along the curve.
final double t;
......@@ -682,9 +670,7 @@ class CatmullRomSpline extends Curve2D {
double tension = 0.0,
Offset? startHandle,
Offset? endHandle,
}) : assert(controlPoints != null),
assert(tension != null),
assert(tension <= 1.0, 'tension $tension must not be greater than 1.0.'),
}) : assert(tension <= 1.0, 'tension $tension must not be greater than 1.0.'),
assert(tension >= 0.0, 'tension $tension must not be negative.'),
assert(controlPoints.length > 3, 'There must be at least four control points to create a CatmullRomSpline.'),
_controlPoints = controlPoints,
......@@ -702,9 +688,7 @@ class CatmullRomSpline extends Curve2D {
double tension = 0.0,
Offset? startHandle,
Offset? endHandle,
}) : assert(controlPoints != null),
assert(tension != null),
assert(tension <= 1.0, 'tension $tension must not be greater than 1.0.'),
}) : assert(tension <= 1.0, 'tension $tension must not be greater than 1.0.'),
assert(tension >= 0.0, 'tension $tension must not be negative.'),
assert(controlPoints.length > 3, 'There must be at least four control points to create a CatmullRomSpline.'),
_controlPoints = null,
......@@ -860,8 +844,7 @@ class CatmullRomCurve extends Curve {
///
/// * This [paper on using Catmull-Rom splines](http://faculty.cs.tamu.edu/schaefer/research/cr_cad.pdf).
CatmullRomCurve(this.controlPoints, {this.tension = 0.0})
: assert(tension != null),
assert(() {
: assert(() {
return validateControlPoints(
controlPoints,
tension: tension,
......@@ -877,8 +860,7 @@ class CatmullRomCurve extends Curve {
/// Same as [CatmullRomCurve.new], but it precomputes the internal curve data
/// structures for a more predictable computation load.
CatmullRomCurve.precompute(this.controlPoints, {this.tension = 0.0})
: assert(tension != null),
assert(() {
: assert(() {
return validateControlPoints(
controlPoints,
tension: tension,
......@@ -963,7 +945,6 @@ class CatmullRomCurve extends Curve {
double tension = 0.0,
List<String>? reasons,
}) {
assert(tension != null);
if (controlPoints == null) {
assert(() {
reasons?.add('Supplied control points cannot be null');
......@@ -1143,7 +1124,7 @@ class FlippedCurve extends Curve {
/// Creates a flipped curve.
///
/// The [curve] argument must not be null.
const FlippedCurve(this.curve) : assert(curve != null);
const FlippedCurve(this.curve);
/// The curve that is being flipped.
final Curve curve;
......
......@@ -364,8 +364,7 @@ class Tween<T extends Object?> extends Animatable<T> {
class ReverseTween<T extends Object?> extends Tween<T> {
/// Construct a [Tween] that evaluates its [parent] in reverse.
ReverseTween(this.parent)
: assert(parent != null),
super(begin: parent.end, end: parent.begin);
: super(begin: parent.end, end: parent.begin);
/// This tween's value is the same as the parent's value evaluated in reverse.
///
......@@ -544,8 +543,7 @@ class CurveTween extends Animatable<double> {
/// Creates a curve tween.
///
/// The [curve] argument must not be null.
CurveTween({ required this.curve })
: assert(curve != null);
CurveTween({ required this.curve });
/// The curve to use when transforming the value of the animation.
Curve curve;
......
......@@ -51,8 +51,7 @@ class TweenSequence<T> extends Animatable<T> {
/// best to reuse one, rather than rebuilding it on every frame, when that's
/// possible.
TweenSequence(List<TweenSequenceItem<T>> items)
: assert(items != null),
assert(items.isNotEmpty) {
: assert(items.isNotEmpty) {
_items.addAll(items);
double totalWeight = 0.0;
......@@ -113,8 +112,7 @@ class FlippedTweenSequence extends TweenSequence<double> {
/// There's a small cost associated with building a `TweenSequence` so it's
/// best to reuse one, rather than rebuilding it on every frame, when that's
/// possible.
FlippedTweenSequence(super.items)
: assert(items != null);
FlippedTweenSequence(super.items);
@override
double transform(double t) => 1 - super.transform(1 - t);
......@@ -128,9 +126,7 @@ class TweenSequenceItem<T> {
const TweenSequenceItem({
required this.tween,
required this.weight,
}) : assert(tween != null),
assert(weight != null),
assert(weight > 0.0);
}) : assert(weight > 0.0);
/// Defines the value of the [TweenSequence] for the interval within the
/// animation's duration indicated by [weight] and this item's position
......
......@@ -385,7 +385,6 @@ mixin SchedulerBinding on BindingBase {
@protected
@mustCallSuper
void handleAppLifecycleStateChanged(AppLifecycleState state) {
assert(state != null);
_lifecycleState = state;
switch (state) {
case AppLifecycleState.resumed:
......@@ -1026,7 +1025,6 @@ mixin SchedulerBinding on BindingBase {
/// presentation time, and can be used to ensure that animations running in
/// different processes are synchronized.
Duration get currentSystemFrameTimeStamp {
assert(_lastRawTimeStamp != null);
return _lastRawTimeStamp;
}
......@@ -1279,7 +1277,6 @@ mixin SchedulerBinding on BindingBase {
// the error.
@pragma('vm:notify-debugger-on-exception')
void _invokeFrameCallback(FrameCallback callback, Duration timeStamp, [ StackTrace? callbackStack ]) {
assert(callback != null);
assert(_FrameCallbackEntry.debugCurrentCallbackStack == null);
assert(() {
_FrameCallbackEntry.debugCurrentCallbackStack = callbackStack;
......
......@@ -211,8 +211,7 @@ class CustomSemanticsAction {
///
/// The [label] must not be null or the empty string.
const CustomSemanticsAction({required String this.label})
: assert(label != null),
assert(label != ''),
: assert(label != ''),
hint = null,
action = null;
......@@ -221,9 +220,7 @@ class CustomSemanticsAction {
///
/// The [hint] must not be null or the empty string.
const CustomSemanticsAction.overridingAction({required String this.hint, required SemanticsAction this.action})
: assert(hint != null),
assert(hint != ''),
assert(action != null),
: assert(hint != ''),
label = null;
/// The user readable name of this custom semantics action.
......@@ -371,8 +368,7 @@ class AttributedStringProperty extends DiagnosticsProperty<AttributedString> {
super.defaultValue,
super.level,
super.description,
}) : assert(showName != null),
assert(level != null);
});
/// Whether to show the property when the [value] is an [AttributedString]
/// whose [AttributedString.string] is the empty string.
......@@ -441,20 +437,12 @@ class SemanticsData with Diagnosticable {
this.tags,
this.transform,
this.customSemanticsActionIds,
}) : assert(flags != null),
assert(actions != null),
assert(attributedLabel != null),
assert(attributedValue != null),
assert(attributedDecreasedValue != null),
assert(attributedIncreasedValue != null),
assert(attributedHint != null),
assert(tooltip == '' || textDirection != null, 'A SemanticsData object with tooltip "$tooltip" had a null textDirection.'),
}) : assert(tooltip == '' || textDirection != null, 'A SemanticsData object with tooltip "$tooltip" had a null textDirection.'),
assert(attributedLabel.string == '' || textDirection != null, 'A SemanticsData object with label "${attributedLabel.string}" had a null textDirection.'),
assert(attributedValue.string == '' || textDirection != null, 'A SemanticsData object with value "${attributedValue.string}" had a null textDirection.'),
assert(attributedDecreasedValue.string == '' || textDirection != null, 'A SemanticsData object with decreasedValue "${attributedDecreasedValue.string}" had a null textDirection.'),
assert(attributedIncreasedValue.string == '' || textDirection != null, 'A SemanticsData object with increasedValue "${attributedIncreasedValue.string}" had a null textDirection.'),
assert(attributedHint.string == '' || textDirection != null, 'A SemanticsData object with hint "${attributedHint.string}" had a null textDirection.'),
assert(rect != null);
assert(attributedHint.string == '' || textDirection != null, 'A SemanticsData object with hint "${attributedHint.string}" had a null textDirection.');
/// A bit field of [SemanticsFlag]s that apply to this node.
final int flags;
......@@ -1721,7 +1709,6 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
Rect get rect => _rect;
Rect _rect = Rect.zero;
set rect(Rect value) {
assert(value != null);
assert(value.isFinite, '$this (with $owner) tried to set a non-finite rect.');
if (_rect != value) {
_rect = value;
......@@ -1806,7 +1793,6 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
bool get isMergedIntoParent => _isMergedIntoParent;
bool _isMergedIntoParent = false;
set isMergedIntoParent(bool value) {
assert(value != null);
if (_isMergedIntoParent == value) {
return;
}
......@@ -1929,7 +1915,6 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
}
}
if (!sawChange && _children != null) {
assert(newChildren != null);
assert(newChildren.length == _children!.length);
// Did the order change?
for (int i = 0; i < _children!.length; i++) {
......@@ -2504,13 +2489,13 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
platformViewId ??= node._platformViewId;
maxValueLength ??= node._maxValueLength;
currentValueLength ??= node._currentValueLength;
if (attributedValue == null || attributedValue.string == '') {
if (attributedValue.string == '') {
attributedValue = node._attributedValue;
}
if (attributedIncreasedValue == null || attributedIncreasedValue.string == '') {
if (attributedIncreasedValue.string == '') {
attributedIncreasedValue = node._attributedIncreasedValue;
}
if (attributedDecreasedValue == null || attributedDecreasedValue.string == '') {
if (attributedDecreasedValue.string == '') {
attributedDecreasedValue = node._attributedDecreasedValue;
}
if (tooltip == '') {
......@@ -2808,7 +2793,6 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
DiagnosticLevel minLevel = DiagnosticLevel.debug,
DebugSemanticsDumpOrder childOrder = DebugSemanticsDumpOrder.traversalOrder,
}) {
assert(childOrder != null);
return toDiagnosticsNode(childOrder: childOrder).toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines, minLevel: minLevel);
}
......@@ -2835,7 +2819,6 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
/// Returns the list of direct children of this node in the specified order.
List<SemanticsNode> debugListChildrenInOrder(DebugSemanticsDumpOrder childOrder) {
assert(childOrder != null);
if (_children == null) {
return const <SemanticsNode>[];
}
......@@ -2862,10 +2845,7 @@ class _BoxEdge implements Comparable<_BoxEdge> {
required this.isLeadingEdge,
required this.offset,
required this.node,
}) : assert(isLeadingEdge != null),
assert(offset != null),
assert(offset.isFinite),
assert(node != null);
}) : assert(offset.isFinite);
/// True if the edge comes before the seconds edge along the traversal
/// direction, and false otherwise.
......@@ -2899,7 +2879,7 @@ class _SemanticsSortGroup extends Comparable<_SemanticsSortGroup> {
_SemanticsSortGroup({
required this.startOffset,
required this.textDirection,
}) : assert(startOffset != null);
});
/// The offset from the start edge of the parent [SemanticsNode] in the
/// direction of the traversal.
......@@ -3122,9 +3102,7 @@ class _TraversalSortNode implements Comparable<_TraversalSortNode> {
required this.node,
this.sortKey,
required this.position,
})
: assert(node != null),
assert(position != null);
});
/// The node whose position this sort node determines.
final SemanticsNode node;
......@@ -3263,7 +3241,6 @@ class SemanticsOwner extends ChangeNotifier {
/// If the given `action` requires arguments they need to be passed in via
/// the `args` parameter.
void performAction(int id, SemanticsAction action, [ Object? args ]) {
assert(action != null);
final SemanticsActionHandler? handler = _getSemanticsActionHandlerForId(id, action);
if (handler != null) {
handler(args);
......@@ -3317,7 +3294,6 @@ class SemanticsOwner extends ChangeNotifier {
/// If the given `action` requires arguments they need to be passed in via
/// the `args` parameter.
void performActionAt(Offset position, SemanticsAction action, [ Object? args ]) {
assert(action != null);
final SemanticsNode? node = rootSemanticsNode;
if (node == null) {
return;
......@@ -3419,7 +3395,6 @@ class SemanticsConfiguration {
/// The provided `handler` is called to respond to the user triggered
/// `action`.
void _addAction(SemanticsAction action, SemanticsActionHandler handler) {
assert(handler != null);
_actions[action] = handler;
_actionsAsBits |= action.index;
_hasBeenAnnotated = true;
......@@ -3431,7 +3406,6 @@ class SemanticsConfiguration {
/// The provided `handler` is called to respond to the user triggered
/// `action`.
void _addArgumentlessAction(SemanticsAction action, VoidCallback handler) {
assert(handler != null);
_addAction(action, (Object? args) {
assert(args == null);
handler();
......@@ -3746,7 +3720,7 @@ class SemanticsConfiguration {
_addAction(SemanticsAction.setSelection, (Object? args) {
assert(args != null && args is Map);
final Map<String, int> selection = (args! as Map<dynamic, dynamic>).cast<String, int>();
assert(selection != null && selection['base'] != null && selection['extent'] != null);
assert(selection['base'] != null && selection['extent'] != null);
value!(TextSelection(
baseOffset: selection['base']!,
extentOffset: selection['extent']!,
......@@ -4004,7 +3978,6 @@ class SemanticsConfiguration {
/// * [attributedLabel], which is the [AttributedString] of this property.
String get label => _attributedLabel.string;
set label(String label) {
assert(label != null);
_attributedLabel = AttributedString(label);
_hasBeenAnnotated = true;
}
......@@ -4045,7 +4018,6 @@ class SemanticsConfiguration {
/// [value] will be after performing [SemanticsAction.decrease].
String get value => _attributedValue.string;
set value(String value) {
assert(value != null);
_attributedValue = AttributedString(value);
_hasBeenAnnotated = true;
}
......@@ -4091,7 +4063,6 @@ class SemanticsConfiguration {
/// * [attributedIncreasedValue], which is the [AttributedString] of this property.
String get increasedValue => _attributedIncreasedValue.string;
set increasedValue(String increasedValue) {
assert(increasedValue != null);
_attributedIncreasedValue = AttributedString(increasedValue);
_hasBeenAnnotated = true;
}
......@@ -4129,7 +4100,6 @@ class SemanticsConfiguration {
/// * [attributedDecreasedValue], which is the [AttributedString] of this property.
String get decreasedValue => _attributedDecreasedValue.string;
set decreasedValue(String decreasedValue) {
assert(decreasedValue != null);
_attributedDecreasedValue = AttributedString(decreasedValue);
_hasBeenAnnotated = true;
}
......@@ -4164,7 +4134,6 @@ class SemanticsConfiguration {
/// * [attributedHint], which is the [AttributedString] of this property.
String get hint => _attributedHint.string;
set hint(String hint) {
assert(hint != null);
_attributedHint = AttributedString(hint);
_hasBeenAnnotated = true;
}
......@@ -4217,7 +4186,7 @@ class SemanticsConfiguration {
double get elevation => _elevation;
double _elevation = 0.0;
set elevation(double value) {
assert(value != null && value >= 0.0);
assert(value >= 0.0);
if (value == _elevation) {
return;
}
......@@ -4234,7 +4203,7 @@ class SemanticsConfiguration {
double get thickness => _thickness;
double _thickness = 0.0;
set thickness(double value) {
assert(value != null && value >= 0.0);
assert(value >= 0.0);
if (value == _thickness) {
return;
}
......@@ -4632,7 +4601,7 @@ class SemanticsConfiguration {
if (_currentValueLength != null && other._currentValueLength != null) {
return false;
}
if (_attributedValue != null && _attributedValue.string.isNotEmpty && other._attributedValue != null && other._attributedValue.string.isNotEmpty) {
if (_attributedValue.string.isNotEmpty && other._attributedValue.string.isNotEmpty) {
return false;
}
return true;
......@@ -4680,13 +4649,13 @@ class SemanticsConfiguration {
otherAttributedString: child._attributedLabel,
otherTextDirection: child.textDirection,
);
if (_attributedValue == null || _attributedValue.string == '') {
if (_attributedValue.string == '') {
_attributedValue = child._attributedValue;
}
if (_attributedIncreasedValue == null || _attributedIncreasedValue.string == '') {
if (_attributedIncreasedValue.string == '') {
_attributedIncreasedValue = child._attributedIncreasedValue;
}
if (_attributedDecreasedValue == null || _attributedDecreasedValue.string == '') {
if (_attributedDecreasedValue.string == '') {
_attributedDecreasedValue = child._attributedDecreasedValue;
}
_attributedHint = _concatAttributedString(
......@@ -4880,8 +4849,7 @@ class OrdinalSortKey extends SemanticsSortKey {
const OrdinalSortKey(
this.order, {
super.name,
}) : assert(order != null),
assert(order > double.negativeInfinity),
}) : assert(order > double.negativeInfinity),
assert(order < double.infinity);
/// Determines the placement of this key in a sequence of keys that defines
......@@ -4894,7 +4862,7 @@ class OrdinalSortKey extends SemanticsSortKey {
@override
int doCompare(OrdinalSortKey other) {
if (other.order == null || order == null || other.order == order) {
if (other.order == order) {
return 0;
}
return order.compareTo(other.order);
......
......@@ -87,9 +87,7 @@ class AnnounceSemanticsEvent extends SemanticsEvent {
/// Constructs an event that triggers an announcement by the platform.
const AnnounceSemanticsEvent(this.message, this.textDirection, {this.assertiveness = Assertiveness.polite})
: assert(message != null),
assert(textDirection != null),
super('announce');
: super('announce');
/// The message to announce.
///
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment