Unverified Commit 98c18ca9 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Remove unnecessary null checks in examples/ (#118848)

parent 54217bd4
...@@ -110,10 +110,7 @@ abstract class RenderSector extends RenderObject { ...@@ -110,10 +110,7 @@ abstract class RenderSector extends RenderObject {
@override @override
void debugAssertDoesMeetConstraints() { void debugAssertDoesMeetConstraints() {
assert(constraints != null);
assert(deltaRadius != null);
assert(deltaRadius < double.infinity); assert(deltaRadius < double.infinity);
assert(deltaTheta != null);
assert(deltaTheta < double.infinity); assert(deltaTheta < double.infinity);
assert(constraints.minDeltaRadius <= deltaRadius); assert(constraints.minDeltaRadius <= deltaRadius);
assert(deltaRadius <= math.max(constraints.minDeltaRadius, constraints.maxDeltaRadius)); assert(deltaRadius <= math.max(constraints.minDeltaRadius, constraints.maxDeltaRadius));
...@@ -174,8 +171,6 @@ abstract class RenderDecoratedSector extends RenderSector { ...@@ -174,8 +171,6 @@ abstract class RenderDecoratedSector extends RenderSector {
// offset must point to the center of the circle // offset must point to the center of the circle
@override @override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
assert(deltaRadius != null);
assert(deltaTheta != null);
assert(parentData is SectorParentData); assert(parentData is SectorParentData);
if (_decoration == null) { if (_decoration == null) {
...@@ -242,7 +237,6 @@ class RenderSectorRing extends RenderSectorWithChildren { ...@@ -242,7 +237,6 @@ class RenderSectorRing extends RenderSectorWithChildren {
double _desiredDeltaRadius; double _desiredDeltaRadius;
double get desiredDeltaRadius => _desiredDeltaRadius; double get desiredDeltaRadius => _desiredDeltaRadius;
set desiredDeltaRadius(double value) { set desiredDeltaRadius(double value) {
assert(value != null);
assert(value >= 0); assert(value >= 0);
if (_desiredDeltaRadius != value) { if (_desiredDeltaRadius != value) {
_desiredDeltaRadius = value; _desiredDeltaRadius = value;
...@@ -254,7 +248,6 @@ class RenderSectorRing extends RenderSectorWithChildren { ...@@ -254,7 +248,6 @@ class RenderSectorRing extends RenderSectorWithChildren {
double get padding => _padding; double get padding => _padding;
set padding(double value) { set padding(double value) {
// TODO(ianh): avoid code duplication // TODO(ianh): avoid code duplication
assert(value != null);
if (_padding != value) { if (_padding != value) {
_padding = value; _padding = value;
markNeedsLayout(); markNeedsLayout();
...@@ -360,7 +353,6 @@ class RenderSectorSlice extends RenderSectorWithChildren { ...@@ -360,7 +353,6 @@ class RenderSectorSlice extends RenderSectorWithChildren {
double _desiredDeltaTheta; double _desiredDeltaTheta;
double get desiredDeltaTheta => _desiredDeltaTheta; double get desiredDeltaTheta => _desiredDeltaTheta;
set desiredDeltaTheta(double value) { set desiredDeltaTheta(double value) {
assert(value != null);
if (_desiredDeltaTheta != value) { if (_desiredDeltaTheta != value) {
_desiredDeltaTheta = value; _desiredDeltaTheta = value;
markNeedsLayout(); markNeedsLayout();
...@@ -371,7 +363,6 @@ class RenderSectorSlice extends RenderSectorWithChildren { ...@@ -371,7 +363,6 @@ class RenderSectorSlice extends RenderSectorWithChildren {
double get padding => _padding; double get padding => _padding;
set padding(double value) { set padding(double value) {
// TODO(ianh): avoid code duplication // TODO(ianh): avoid code duplication
assert(value != null);
if (_padding != value) { if (_padding != value) {
_padding = value; _padding = value;
markNeedsLayout(); markNeedsLayout();
...@@ -519,8 +510,6 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil ...@@ -519,8 +510,6 @@ class RenderBoxToRenderSectorAdapter extends RenderBox with RenderObjectWithChil
}) { }) {
assert(child is RenderSector); assert(child is RenderSector);
assert(child!.parentData is SectorParentData); assert(child!.parentData is SectorParentData);
assert(width != null);
assert(height != null);
if (!width.isFinite && !height.isFinite) { if (!width.isFinite && !height.isFinite) {
return Size.zero; return Size.zero;
} }
...@@ -649,9 +638,7 @@ class SectorHitTestEntry extends HitTestEntry { ...@@ -649,9 +638,7 @@ class SectorHitTestEntry extends HitTestEntry {
/// Creates a box hit test entry. /// Creates a box hit test entry.
/// ///
/// The [radius] and [theta] argument must not be null. /// The [radius] and [theta] argument must not be null.
SectorHitTestEntry(RenderSector super.target, { required this.radius, required this.theta }) SectorHitTestEntry(RenderSector super.target, { required this.radius, required this.theta });
: assert(radius != null),
assert(theta != null);
@override @override
RenderSector get target => super.target as RenderSector; RenderSector get target => super.target as RenderSector;
......
...@@ -17,11 +17,7 @@ typedef OnResultListener = void Function(String result); ...@@ -17,11 +17,7 @@ typedef OnResultListener = void Function(String result);
// in real-world applications. // in real-world applications.
class Calculator { class Calculator {
Calculator({ required this.onProgressListener, required this.onResultListener, String? data }) Calculator({ required this.onProgressListener, required this.onResultListener, String? data })
: assert(onProgressListener != null), : _data = _replicateJson(data, 10000);
assert(onResultListener != null),
// In order to keep the example files smaller, we "cheat" a little and
// replicate our small json string into a 10,000-element array.
_data = _replicateJson(data, 10000);
final OnProgressListener onProgressListener; final OnProgressListener onProgressListener;
final OnResultListener onResultListener; final OnResultListener onResultListener;
...@@ -87,9 +83,7 @@ class CalculationMessage { ...@@ -87,9 +83,7 @@ class CalculationMessage {
// progress of the background computation. // progress of the background computation.
class CalculationManager { class CalculationManager {
CalculationManager({ required this.onProgressListener, required this.onResultListener }) CalculationManager({ required this.onProgressListener, required this.onResultListener })
: assert(onProgressListener != null), : _receivePort = ReceivePort() {
assert(onResultListener != null),
_receivePort = ReceivePort() {
_receivePort.listen(_handleMessage); _receivePort.listen(_handleMessage);
} }
......
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