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
f5249bcb
Unverified
Commit
f5249bcb
authored
Dec 13, 2022
by
Michael Thomsen
Committed by
GitHub
Dec 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove use of NullThrownError (#116122)
parent
7211ca09
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1 addition
and
88 deletions
+1
-88
assertions.dart
packages/flutter/lib/src/foundation/assertions.dart
+1
-3
_compute_caller_unsound_null_safety.dart
.../test/foundation/_compute_caller_unsound_null_safety.dart
+0
-30
_compute_caller_unsound_null_safety_error.dart
...foundation/_compute_caller_unsound_null_safety_error.dart
+0
-22
assertions_test.dart
packages/flutter/test/foundation/assertions_test.dart
+0
-22
isolates_test.dart
packages/flutter/test/foundation/isolates_test.dart
+0
-11
No files found.
packages/flutter/lib/src/foundation/assertions.dart
View file @
f5249bcb
...
...
@@ -672,9 +672,7 @@ class FlutterErrorDetails with Diagnosticable {
super
.
debugFillProperties
(
properties
);
final
DiagnosticsNode
verb
=
ErrorDescription
(
'thrown
${ context != null ? ErrorDescription(" $context") : ""}
'
);
final
Diagnosticable
?
diagnosticable
=
_exceptionToDiagnosticable
();
if
(
exception
is
NullThrownError
)
{
// ignore: deprecated_member_use
properties
.
add
(
ErrorDescription
(
'The null value was
$verb
.'
));
}
else
if
(
exception
is
num
)
{
if
(
exception
is
num
)
{
properties
.
add
(
ErrorDescription
(
'The number
$exception
was
$verb
.'
));
}
else
{
final
DiagnosticsNode
errorName
;
...
...
packages/flutter/test/foundation/_compute_caller_unsound_null_safety.dart
deleted
100644 → 0
View file @
7211ca09
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Running in unsound null-safety mode is intended to test for potential miscasts
// or invalid assertions.
import
'package:flutter/src/foundation/_isolates_io.dart'
;
import
'package:flutter/src/foundation/isolates.dart'
as
isolates
;
int
?
returnInt
(
int
?
arg
)
{
return
arg
;
}
Future
<
int
?>
returnIntAsync
(
int
?
arg
)
{
return
Future
<
int
>.
value
(
arg
);
}
Future
<
void
>
testCompute
<
T
>(
isolates
.
ComputeCallback
<
T
,
T
>
callback
,
T
input
)
async
{
if
(
input
!=
await
compute
(
callback
,
input
))
{
throw
Exception
(
'compute returned bad result'
);
}
}
void
main
(
)
async
{
await
testCompute
(
returnInt
,
10
);
await
testCompute
(
returnInt
,
null
);
await
testCompute
(
returnIntAsync
,
10
);
await
testCompute
(
returnIntAsync
,
null
);
}
packages/flutter/test/foundation/_compute_caller_unsound_null_safety_error.dart
deleted
100644 → 0
View file @
7211ca09
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Running in unsound null-safety mode is intended to test for potential miscasts
// or invalid assertions.
import
'package:flutter/src/foundation/_isolates_io.dart'
;
int
throwNull
(
dynamic
arg
)
{
throw
arg
as
Object
;
}
void
main
(
)
async
{
try
{
await
compute
(
throwNull
,
null
);
}
catch
(
e
)
{
if
(
e
is
!
TypeError
&&
e
is
!
NullThrownError
)
{
// ignore: deprecated_member_use
throw
Exception
(
'compute returned bad result'
);
}
}
}
packages/flutter/test/foundation/assertions_test.dart
View file @
f5249bcb
...
...
@@ -58,21 +58,6 @@ void main() {
'INFO
\n
'
'═════════════════════════════════════════════════════════════════
\n
'
,
);
expect
(
FlutterErrorDetails
(
exception:
NullThrownError
(),
// ignore: deprecated_member_use
library
:
'LIBRARY'
,
context:
ErrorDescription
(
'CONTEXTING'
),
informationCollector:
()
sync
*
{
yield
ErrorDescription
(
'INFO'
);
},
).
toString
(),
'══╡ EXCEPTION CAUGHT BY LIBRARY ╞════════════════════════════════
\n
'
'The null value was thrown CONTEXTING.
\n
'
'
\n
'
'INFO
\n
'
'═════════════════════════════════════════════════════════════════
\n
'
,
);
expect
(
FlutterErrorDetails
(
exception:
'MESSAGE'
,
...
...
@@ -112,13 +97,6 @@ void main() {
'MESSAGE
\n
'
'═════════════════════════════════════════════════════════════════
\n
'
,
);
expect
(
// ignore: deprecated_member_use
FlutterErrorDetails
(
exception:
NullThrownError
()).
toString
(),
'══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞══════════════════════
\n
'
'The null value was thrown.
\n
'
'═════════════════════════════════════════════════════════════════
\n
'
,
);
});
test
(
'FlutterErrorDetails.toStringShort'
,
()
{
...
...
packages/flutter/test/foundation/isolates_test.dart
View file @
f5249bcb
...
...
@@ -221,15 +221,4 @@ void main() {
'_compute_caller_invalid_message.dart'
);
});
},
skip:
kIsWeb
);
// [intended] isn't supported on the web.
group
(
'compute() works with unsound null safety caller'
,
()
{
test
(
'returning'
,
()
async
{
await
expectFileSuccessfullyCompletes
(
'_compute_caller_unsound_null_safety.dart'
,
true
);
});
test
(
'erroring'
,
()
async
{
await
expectFileSuccessfullyCompletes
(
'_compute_caller_unsound_null_safety_error.dart'
,
true
);
});
},
skip:
kIsWeb
);
// [intended] isn't supported on the web.
}
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