Unverified Commit 817b959b authored by LongCatIsLooong's avatar LongCatIsLooong Committed by GitHub

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
parent ed950969
...@@ -54,17 +54,21 @@ import 'thumb_painter.dart'; ...@@ -54,17 +54,21 @@ import 'thumb_painter.dart';
class CupertinoSwitch extends StatefulWidget { class CupertinoSwitch extends StatefulWidget {
/// Creates an iOS-style switch. /// 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({ const CupertinoSwitch({
Key key, Key key,
@required this.value, @required this.value,
@required this.onChanged, @required this.onChanged,
this.activeColor, this.activeColor,
this.dragStartBehavior = DragStartBehavior.start, this.dragStartBehavior = DragStartBehavior.start,
}) : assert(dragStartBehavior != null), }) : assert(value != null),
assert(dragStartBehavior != null),
super(key: key); super(key: key);
/// Whether this switch is on or off. /// Whether this switch is on or off.
///
/// Must not be null.
final bool value; final bool value;
/// Called when the user toggles with switch on or off. /// Called when the user toggles with switch on or off.
......
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