Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
98c18ca9
Unverified
Commit
98c18ca9
authored
Jan 20, 2023
by
Michael Goderbauer
Committed by
GitHub
Jan 20, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary null checks in examples/ (#118848)
parent
54217bd4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
22 deletions
+3
-22
sector_layout.dart
examples/layers/rendering/src/sector_layout.dart
+1
-14
isolate.dart
examples/layers/services/isolate.dart
+2
-8
No files found.
examples/layers/rendering/src/sector_layout.dart
View file @
98c18ca9
...
@@ -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
;
...
...
examples/layers/services/isolate.dart
View file @
98c18ca9
...
@@ -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
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment