Commit 0f1132f9 authored by Phil Quitslund's avatar Phil Quitslund Committed by GitHub

Merge pull request #4559 from pq/missing_returns

Add missing returns.
parents 294376fb d3b41867
......@@ -83,6 +83,8 @@ class OperationToken extends ExpressionToken {
case Operation.Division:
return ' \u00F7 ';
}
assert(operation != null);
return null;
}
}
......@@ -257,6 +259,8 @@ class CalcExpression {
case ExpressionState.NumberWithPoint:
case ExpressionState.Result:
return appendOperation(Operation.Subtraction);
default:
return null;
}
}
......
......@@ -130,6 +130,8 @@ class GridDemoPhotoItem extends StatelessWidget {
child: image
);
}
assert(tileStyle != null);
return null;
}
}
......
......@@ -75,6 +75,8 @@ class StocksAppState extends State<StocksApp> {
accentColor: Colors.redAccent[200]
);
}
assert(_configuration.stockMode != null);
return null;
}
Route<Null> _getRoute(RouteSettings settings) {
......
......@@ -287,6 +287,8 @@ class ReverseAnimation extends Animation<double>
case AnimationStatus.completed: return AnimationStatus.dismissed;
case AnimationStatus.dismissed: return AnimationStatus.completed;
}
assert(status != null);
return null;
}
@override
......
......@@ -157,7 +157,6 @@ class Expression extends EquationMember {
if (!m.isConstant) {
throw new ParserException(
'The divisor was not a constant expression', <EquationMember>[this, m]);
return null;
}
return this._applyMultiplicand(1.0 / m.value);
......
......@@ -227,6 +227,8 @@ class _MaterialButtonState extends State<MaterialButton> {
return Colors.white30;
}
}
assert(_colorBrightness != null);
return null;
}
void _handleHighlightChanged(bool value) {
......
......@@ -57,12 +57,15 @@ class Dialog extends StatelessWidget {
final List<Widget> actions;
Color _getColor(BuildContext context) {
switch (Theme.of(context).brightness) {
Brightness brightness = Theme.of(context).brightness;
switch (brightness) {
case Brightness.light:
return Colors.white;
case Brightness.dark:
return Colors.grey[800];
}
assert(brightness != null);
return null;
}
@override
......
......@@ -67,6 +67,8 @@ class DrawerItem extends StatelessWidget {
return Colors.white30;
return null; // use default icon theme colour unmodified
}
assert(themeData.brightness != null);
return null;
}
TextStyle _getTextStyle(ThemeData themeData) {
......
......@@ -65,6 +65,8 @@ class Icon extends StatelessWidget {
case Brightness.light:
return Colors.black;
}
assert(brightness != null);
return null;
}
Color _getDefaultColor(BuildContext context) {
......
......@@ -98,12 +98,15 @@ class RaisedButton extends StatelessWidget {
} else {
if (disabledColor != null)
return disabledColor;
switch (Theme.of(context).brightness) {
Brightness brightness = Theme.of(context).brightness;
switch (brightness) {
case Brightness.light:
return Colors.black12;
case Brightness.dark:
return Colors.white12;
}
assert(brightness != null);
return null;
}
}
......
......@@ -186,4 +186,6 @@ Widget buildTextSelectionHandle(
child: handle
);
}
assert(type != null);
return null;
}
......@@ -1353,6 +1353,8 @@ class BoxDecoration extends Decoration {
double distance = (position - center).distance;
return distance <= math.min(size.width, size.height) / 2.0;
}
assert(shape != null);
return null;
}
@override
......
......@@ -125,6 +125,8 @@ class TextPainter {
case TextBaseline.ideographic:
return _paragraph.ideographicBaseline;
}
assert(baseline != null);
return null;
}
double _lastMinWidth;
......@@ -211,6 +213,8 @@ class TextPainter {
?? _getOffsetFromUpstream(offset, caretPrototype)
?? emptyOffset;
}
assert(position.affinity != null);
return null;
}
/// Returns a list of rects that bound the given selection.
......
......@@ -1125,7 +1125,6 @@ abstract class RenderBox extends RenderObject {
'set a size and lay out any children, or, set sizedByParent to true '
'so that performResize() sizes the render object.'
);
return true;
}
return true;
});
......
......@@ -82,6 +82,8 @@ class RenderList extends RenderVirtualViewport<ListParentData> {
case Axis.horizontal:
return padding.horizontal;
}
assert(mainAxis != null);
return null;
}
double get _preferredExtent {
......@@ -108,6 +110,8 @@ class RenderList extends RenderVirtualViewport<ListParentData> {
assert(debugThrowIfNotCheckingIntrinsics());
return 0.0;
}
assert(mainAxis != null);
return null;
}
@override
......
......@@ -57,6 +57,8 @@ class ViewportDimensions {
case ViewportAnchor.end:
return paintOffset + (containerSize - contentSize);
}
assert(anchor != null);
return null;
}
@override
......@@ -108,6 +110,8 @@ class RenderViewportBase extends RenderBox {
case Axis.vertical:
return offset.dx == 0.0;
}
assert(direction != null);
return null;
}
/// The offset at which to paint the child.
......
......@@ -90,6 +90,8 @@ class BannerPainter extends CustomPainter {
case BannerLocation.topLeft:
return 0.0;
}
assert(location != null);
return null;
}
double _translationY(double height) {
......@@ -101,6 +103,8 @@ class BannerPainter extends CustomPainter {
case BannerLocation.topLeft:
return 0.0;
}
assert(location != null);
return null;
}
double get _rotation {
......@@ -112,6 +116,8 @@ class BannerPainter extends CustomPainter {
case BannerLocation.topLeft:
return -math.PI / 4.0;
}
assert(location != null);
return null;
}
}
......
......@@ -245,7 +245,6 @@ class _DismissableState extends State<Dismissable> {
return vy > _kMinFlingVelocity;
}
}
return false;
}
void _handleDragEnd(DragEndDetails details) {
......
......@@ -731,6 +731,8 @@ class _LazyBlockElement extends RenderObjectElement {
case Axis.vertical:
return size.height;
}
assert(widget.mainAxis != null);
return null;
}
Offset _getMainAxisOffsetForSize(Size size) {
......@@ -740,6 +742,8 @@ class _LazyBlockElement extends RenderObjectElement {
case Axis.vertical:
return new Offset(0.0, size.height);
}
assert(widget.mainAxis != null);
return null;
}
static RenderBox _getNextWithin(_RenderLazyBlock block, RenderBox child) {
......
......@@ -224,6 +224,8 @@ abstract class PageableState<T extends Pageable> extends ScrollableState<T> {
case Axis.vertical:
return box.size.height;
}
assert(config.scrollDirection != null);
return null;
}
@override
......@@ -248,6 +250,8 @@ abstract class PageableState<T extends Pageable> extends ScrollableState<T> {
case ViewportAnchor.end:
return (_itemCount - scrollIndex - 1) % itemCount;
}
assert(config.scrollAnchor != null);
return null;
}
@override
......@@ -324,6 +328,8 @@ abstract class PageableState<T extends Pageable> extends ScrollableState<T> {
case PageableListFlingBehavior.stopAtNextPage:
return _flingToAdjacentItem(scrollVelocity);
}
assert(config.itemsSnapAlignment != null);
return null;
}
@override
......
......@@ -285,6 +285,8 @@ class ScrollableState<T extends Scrollable> extends State<T> {
case ViewportAnchor.end:
return pixelOffset;
}
assert(config.scrollAnchor != null);
return null;
}
/// Convert a scrollOffset value to the number of pixels to which it corresponds.
......
......@@ -239,6 +239,8 @@ class _VirtualListViewport extends VirtualViewport {
}
break;
}
assert(mainAxis != null);
return null;
}
@override
......
......@@ -294,5 +294,7 @@ class _TextSelectionHandleOverlayState extends State<_TextSelectionHandleOverlay
case TextDirection.rtl:
return rtlType;
}
assert(endpoint.direction != null);
return null;
}
}
......@@ -70,6 +70,8 @@ abstract class VirtualViewportElement extends RenderObjectElement {
case ViewportAnchor.end:
return scrollOffset;
}
assert(renderObject.anchor != null);
return null;
}
/// Returns a two-dimensional representation of the scroll offset, accounting
......
......@@ -23,12 +23,15 @@ class TestOrientedBox extends SingleChildRenderObjectWidget {
TestOrientedBox({ Key key, Widget child }) : super(key: key, child: child);
Decoration _getDecoration(BuildContext context) {
switch (MediaQuery.of(context).orientation) {
Orientation orientation = MediaQuery.of(context).orientation;
switch (orientation) {
case Orientation.landscape:
return new BoxDecoration(backgroundColor: const Color(0xFF00FF00));
case Orientation.portrait:
return new BoxDecoration(backgroundColor: const Color(0xFF0000FF));
}
assert(orientation != null);
return null;
}
@override
......
......@@ -134,6 +134,8 @@ ApplicationPackage getApplicationPackageForPlatform(TargetPlatform platform) {
case TargetPlatform.linux_x64:
return null;
}
assert(platform != null);
return null;
}
class ApplicationPackageStore {
......@@ -156,5 +158,6 @@ class ApplicationPackageStore {
case TargetPlatform.linux_x64:
return null;
}
return null;
}
}
......@@ -53,6 +53,7 @@ String getNameForHostPlatform(HostPlatform platform) {
return 'linux-x64';
}
assert(false);
return null;
}
enum TargetPlatform {
......@@ -80,6 +81,7 @@ String getNameForTargetPlatform(TargetPlatform platform) {
return 'linux-x64';
}
assert(false);
return null;
}
TargetPlatform getTargetPlatformForName(String platform) {
......@@ -97,6 +99,7 @@ TargetPlatform getTargetPlatformForName(String platform) {
case 'linux-x64':
return TargetPlatform.linux_x64;
}
assert(platform != null);
return null;
}
......
......@@ -349,7 +349,6 @@ class IOSDevice extends Device {
} else {
return false;
}
return false;
}
@override
......
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