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';
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.
......
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