Commit f5a4e632 authored by pq's avatar pq

Added asserts.

parent 7a955487
...@@ -83,6 +83,7 @@ class OperationToken extends ExpressionToken { ...@@ -83,6 +83,7 @@ class OperationToken extends ExpressionToken {
case Operation.Division: case Operation.Division:
return ' \u00F7 '; return ' \u00F7 ';
} }
assert(operation != null);
return null; return null;
} }
} }
......
...@@ -46,7 +46,7 @@ class GridDemoPhotoItem extends StatelessWidget { ...@@ -46,7 +46,7 @@ class GridDemoPhotoItem extends StatelessWidget {
} }
final Photo photo; final Photo photo;
final GridDemoTileStyle tileStyle; final GridDemoTileStyle tileStyle;
final BannerTapCallback onBannerTap; // User taps on the photo's header or footer. final BannerTapCallback onBannerTap; // User taps on the photo's header or footer.
void showPhoto(BuildContext context) { void showPhoto(BuildContext context) {
...@@ -130,6 +130,7 @@ class GridDemoPhotoItem extends StatelessWidget { ...@@ -130,6 +130,7 @@ class GridDemoPhotoItem extends StatelessWidget {
child: image child: image
); );
} }
assert(tileStyle != null);
return null; return null;
} }
} }
......
...@@ -75,6 +75,7 @@ class StocksAppState extends State<StocksApp> { ...@@ -75,6 +75,7 @@ class StocksAppState extends State<StocksApp> {
accentColor: Colors.redAccent[200] accentColor: Colors.redAccent[200]
); );
} }
assert(_configuration.stockMode != null);
return null; return null;
} }
......
...@@ -287,6 +287,7 @@ class ReverseAnimation extends Animation<double> ...@@ -287,6 +287,7 @@ class ReverseAnimation extends Animation<double>
case AnimationStatus.completed: return AnimationStatus.dismissed; case AnimationStatus.completed: return AnimationStatus.dismissed;
case AnimationStatus.dismissed: return AnimationStatus.completed; case AnimationStatus.dismissed: return AnimationStatus.completed;
} }
assert(status != null);
return null; return null;
} }
......
...@@ -227,6 +227,7 @@ class _MaterialButtonState extends State<MaterialButton> { ...@@ -227,6 +227,7 @@ class _MaterialButtonState extends State<MaterialButton> {
return Colors.white30; return Colors.white30;
} }
} }
assert(_colorBrightness != null);
return null; return null;
} }
......
...@@ -57,12 +57,14 @@ class Dialog extends StatelessWidget { ...@@ -57,12 +57,14 @@ class Dialog extends StatelessWidget {
final List<Widget> actions; final List<Widget> actions;
Color _getColor(BuildContext context) { Color _getColor(BuildContext context) {
switch (Theme.of(context).brightness) { Brightness brightness = Theme.of(context).brightness;
switch (brightness) {
case Brightness.light: case Brightness.light:
return Colors.white; return Colors.white;
case Brightness.dark: case Brightness.dark:
return Colors.grey[800]; return Colors.grey[800];
} }
assert(brightness != null);
return null; return null;
} }
......
...@@ -67,6 +67,7 @@ class DrawerItem extends StatelessWidget { ...@@ -67,6 +67,7 @@ class DrawerItem extends StatelessWidget {
return Colors.white30; return Colors.white30;
return null; // use default icon theme colour unmodified return null; // use default icon theme colour unmodified
} }
assert(themeData.brightness != null);
return null; return null;
} }
......
...@@ -65,6 +65,7 @@ class Icon extends StatelessWidget { ...@@ -65,6 +65,7 @@ class Icon extends StatelessWidget {
case Brightness.light: case Brightness.light:
return Colors.black; return Colors.black;
} }
assert(brightness != null);
return null; return null;
} }
......
...@@ -98,12 +98,14 @@ class RaisedButton extends StatelessWidget { ...@@ -98,12 +98,14 @@ class RaisedButton extends StatelessWidget {
} else { } else {
if (disabledColor != null) if (disabledColor != null)
return disabledColor; return disabledColor;
Brightness brightness = Theme.of(context).brightness;
switch (Theme.of(context).brightness) { switch (Theme.of(context).brightness) {
case Brightness.light: case Brightness.light:
return Colors.black12; return Colors.black12;
case Brightness.dark: case Brightness.dark:
return Colors.white12; return Colors.white12;
} }
assert(brightness != null);
return null; return null;
} }
} }
......
...@@ -186,5 +186,6 @@ Widget buildTextSelectionHandle( ...@@ -186,5 +186,6 @@ Widget buildTextSelectionHandle(
child: handle child: handle
); );
} }
assert(type != null);
return null; return null;
} }
...@@ -1353,6 +1353,7 @@ class BoxDecoration extends Decoration { ...@@ -1353,6 +1353,7 @@ class BoxDecoration extends Decoration {
double distance = (position - center).distance; double distance = (position - center).distance;
return distance <= math.min(size.width, size.height) / 2.0; return distance <= math.min(size.width, size.height) / 2.0;
} }
assert(shape != null);
return null; return null;
} }
......
...@@ -125,6 +125,7 @@ class TextPainter { ...@@ -125,6 +125,7 @@ class TextPainter {
case TextBaseline.ideographic: case TextBaseline.ideographic:
return _paragraph.ideographicBaseline; return _paragraph.ideographicBaseline;
} }
assert(baseline != null);
return null; return null;
} }
...@@ -212,6 +213,7 @@ class TextPainter { ...@@ -212,6 +213,7 @@ class TextPainter {
?? _getOffsetFromUpstream(offset, caretPrototype) ?? _getOffsetFromUpstream(offset, caretPrototype)
?? emptyOffset; ?? emptyOffset;
} }
assert(position.affinity != null);
return null; return null;
} }
......
...@@ -82,6 +82,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> { ...@@ -82,6 +82,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> {
case Axis.horizontal: case Axis.horizontal:
return padding.horizontal; return padding.horizontal;
} }
assert(mainAxis != null);
return null; return null;
} }
...@@ -109,6 +110,8 @@ class RenderList extends RenderVirtualViewport<ListParentData> { ...@@ -109,6 +110,8 @@ class RenderList extends RenderVirtualViewport<ListParentData> {
assert(debugThrowIfNotCheckingIntrinsics()); assert(debugThrowIfNotCheckingIntrinsics());
return 0.0; return 0.0;
} }
assert(mainAxis != null);
return null;
} }
@override @override
......
...@@ -57,6 +57,7 @@ class ViewportDimensions { ...@@ -57,6 +57,7 @@ class ViewportDimensions {
case ViewportAnchor.end: case ViewportAnchor.end:
return paintOffset + (containerSize - contentSize); return paintOffset + (containerSize - contentSize);
} }
assert(anchor != null);
return null; return null;
} }
...@@ -109,6 +110,8 @@ class RenderViewportBase extends RenderBox { ...@@ -109,6 +110,8 @@ class RenderViewportBase extends RenderBox {
case Axis.vertical: case Axis.vertical:
return offset.dx == 0.0; return offset.dx == 0.0;
} }
assert(direction != null);
return null;
} }
/// The offset at which to paint the child. /// The offset at which to paint the child.
......
...@@ -90,6 +90,8 @@ class BannerPainter extends CustomPainter { ...@@ -90,6 +90,8 @@ class BannerPainter extends CustomPainter {
case BannerLocation.topLeft: case BannerLocation.topLeft:
return 0.0; return 0.0;
} }
assert(location != null);
return null;
} }
double _translationY(double height) { double _translationY(double height) {
...@@ -101,6 +103,8 @@ class BannerPainter extends CustomPainter { ...@@ -101,6 +103,8 @@ class BannerPainter extends CustomPainter {
case BannerLocation.topLeft: case BannerLocation.topLeft:
return 0.0; return 0.0;
} }
assert(location != null);
return null;
} }
double get _rotation { double get _rotation {
...@@ -112,6 +116,7 @@ class BannerPainter extends CustomPainter { ...@@ -112,6 +116,7 @@ class BannerPainter extends CustomPainter {
case BannerLocation.topLeft: case BannerLocation.topLeft:
return -math.PI / 4.0; return -math.PI / 4.0;
} }
assert(location != null);
return null; return null;
} }
} }
......
...@@ -731,6 +731,8 @@ class _LazyBlockElement extends RenderObjectElement { ...@@ -731,6 +731,8 @@ class _LazyBlockElement extends RenderObjectElement {
case Axis.vertical: case Axis.vertical:
return size.height; return size.height;
} }
assert(widget.mainAxis != null);
return null;
} }
Offset _getMainAxisOffsetForSize(Size size) { Offset _getMainAxisOffsetForSize(Size size) {
...@@ -740,6 +742,7 @@ class _LazyBlockElement extends RenderObjectElement { ...@@ -740,6 +742,7 @@ class _LazyBlockElement extends RenderObjectElement {
case Axis.vertical: case Axis.vertical:
return new Offset(0.0, size.height); return new Offset(0.0, size.height);
} }
assert(widget.mainAxis != null);
return null; return null;
} }
......
...@@ -224,6 +224,7 @@ abstract class PageableState<T extends Pageable> extends ScrollableState<T> { ...@@ -224,6 +224,7 @@ abstract class PageableState<T extends Pageable> extends ScrollableState<T> {
case Axis.vertical: case Axis.vertical:
return box.size.height; return box.size.height;
} }
assert(config.scrollDirection != null);
return null; return null;
} }
...@@ -249,6 +250,8 @@ abstract class PageableState<T extends Pageable> extends ScrollableState<T> { ...@@ -249,6 +250,8 @@ abstract class PageableState<T extends Pageable> extends ScrollableState<T> {
case ViewportAnchor.end: case ViewportAnchor.end:
return (_itemCount - scrollIndex - 1) % itemCount; return (_itemCount - scrollIndex - 1) % itemCount;
} }
assert(config.scrollAnchor != null);
return null;
} }
@override @override
...@@ -325,6 +328,8 @@ abstract class PageableState<T extends Pageable> extends ScrollableState<T> { ...@@ -325,6 +328,8 @@ abstract class PageableState<T extends Pageable> extends ScrollableState<T> {
case PageableListFlingBehavior.stopAtNextPage: case PageableListFlingBehavior.stopAtNextPage:
return _flingToAdjacentItem(scrollVelocity); return _flingToAdjacentItem(scrollVelocity);
} }
assert(config.itemsSnapAlignment != null);
return null;
} }
@override @override
......
...@@ -285,6 +285,7 @@ class ScrollableState<T extends Scrollable> extends State<T> { ...@@ -285,6 +285,7 @@ class ScrollableState<T extends Scrollable> extends State<T> {
case ViewportAnchor.end: case ViewportAnchor.end:
return pixelOffset; return pixelOffset;
} }
assert(config.scrollAnchor != null);
return null; return null;
} }
......
...@@ -239,6 +239,7 @@ class _VirtualListViewport extends VirtualViewport { ...@@ -239,6 +239,7 @@ class _VirtualListViewport extends VirtualViewport {
} }
break; break;
} }
assert(mainAxis != null);
return null; return null;
} }
......
...@@ -294,6 +294,7 @@ class _TextSelectionHandleOverlayState extends State<_TextSelectionHandleOverlay ...@@ -294,6 +294,7 @@ class _TextSelectionHandleOverlayState extends State<_TextSelectionHandleOverlay
case TextDirection.rtl: case TextDirection.rtl:
return rtlType; return rtlType;
} }
assert(endpoint.direction != null);
return null; return null;
} }
} }
...@@ -70,6 +70,7 @@ abstract class VirtualViewportElement extends RenderObjectElement { ...@@ -70,6 +70,7 @@ abstract class VirtualViewportElement extends RenderObjectElement {
case ViewportAnchor.end: case ViewportAnchor.end:
return scrollOffset; return scrollOffset;
} }
assert(renderObject.anchor != null);
return null; return null;
} }
......
...@@ -23,12 +23,14 @@ class TestOrientedBox extends SingleChildRenderObjectWidget { ...@@ -23,12 +23,14 @@ class TestOrientedBox extends SingleChildRenderObjectWidget {
TestOrientedBox({ Key key, Widget child }) : super(key: key, child: child); TestOrientedBox({ Key key, Widget child }) : super(key: key, child: child);
Decoration _getDecoration(BuildContext context) { Decoration _getDecoration(BuildContext context) {
switch (MediaQuery.of(context).orientation) { Orientation orientation = MediaQuery.of(context).orientation;
switch (orientation) {
case Orientation.landscape: case Orientation.landscape:
return new BoxDecoration(backgroundColor: const Color(0xFF00FF00)); return new BoxDecoration(backgroundColor: const Color(0xFF00FF00));
case Orientation.portrait: case Orientation.portrait:
return new BoxDecoration(backgroundColor: const Color(0xFF0000FF)); return new BoxDecoration(backgroundColor: const Color(0xFF0000FF));
} }
assert(orientation != null);
return null; return null;
} }
......
...@@ -134,6 +134,7 @@ ApplicationPackage getApplicationPackageForPlatform(TargetPlatform platform) { ...@@ -134,6 +134,7 @@ ApplicationPackage getApplicationPackageForPlatform(TargetPlatform platform) {
case TargetPlatform.linux_x64: case TargetPlatform.linux_x64:
return null; return null;
} }
assert(platform != null);
return null; return null;
} }
......
...@@ -99,6 +99,7 @@ TargetPlatform getTargetPlatformForName(String platform) { ...@@ -99,6 +99,7 @@ TargetPlatform getTargetPlatformForName(String platform) {
case 'linux-x64': case 'linux-x64':
return TargetPlatform.linux_x64; return TargetPlatform.linux_x64;
} }
assert(platform != null);
return null; return null;
} }
......
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