From 817b959bfd42f395242107a1c10cfec92ac96382 Mon Sep 17 00:00:00 2001 From: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com> Date: Wed, 27 Mar 2019 13:41:47 -0400 Subject: [PATCH] update CupertinoSwitch documentation (#29987) Documented CupertinoSwitch.value that it can't be null and added an assertion value != null in the constructor. Related issue: #12948 --- packages/flutter/lib/src/cupertino/switch.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/flutter/lib/src/cupertino/switch.dart b/packages/flutter/lib/src/cupertino/switch.dart index 9ba6a6b4d0..66dd714e73 100644 --- a/packages/flutter/lib/src/cupertino/switch.dart +++ b/packages/flutter/lib/src/cupertino/switch.dart @@ -54,17 +54,21 @@ import 'thumb_painter.dart'; class CupertinoSwitch extends StatefulWidget { /// Creates an iOS-style switch. /// - /// [dragStartBehavior] must not be null. + /// The [value] parameter must not be null. + /// The [dragStartBehavior] parameter defaults to [DragStartBehavior.start] and must not be null. const CupertinoSwitch({ Key key, @required this.value, @required this.onChanged, this.activeColor, this.dragStartBehavior = DragStartBehavior.start, - }) : assert(dragStartBehavior != null), + }) : assert(value != null), + assert(dragStartBehavior != null), super(key: key); /// Whether this switch is on or off. + /// + /// Must not be null. final bool value; /// Called when the user toggles with switch on or off.