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
c02d53fc
Unverified
Commit
c02d53fc
authored
Dec 11, 2022
by
Ian Hickson
Committed by
GitHub
Dec 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More gracefully handle license loading failures (#87841)
parent
ec02f3bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
about.dart
packages/flutter/lib/src/material/about.dart
+11
-0
about_test.dart
packages/flutter/test/material/about_test.dart
+18
-0
No files found.
packages/flutter/lib/src/material/about.dart
View file @
c02d53fc
...
...
@@ -571,6 +571,17 @@ class _PackagesViewState extends State<_PackagesView> {
builder:
(
BuildContext
context
,
BoxConstraints
constraints
)
{
switch
(
snapshot
.
connectionState
)
{
case
ConnectionState
.
done
:
if
(
snapshot
.
hasError
)
{
assert
(()
{
FlutterError
.
reportError
(
FlutterErrorDetails
(
exception:
snapshot
.
error
!,
stack:
snapshot
.
stackTrace
,
context:
ErrorDescription
(
'while decoding the license file'
),
));
return
true
;
}());
return
Center
(
child:
Text
(
snapshot
.
error
.
toString
()));
}
_initDefaultDetailPage
(
snapshot
.
data
!,
context
);
return
ValueListenableBuilder
<
int
?>(
valueListenable:
widget
.
selectedId
,
...
...
packages/flutter/test/material/about_test.dart
View file @
c02d53fc
...
...
@@ -997,6 +997,24 @@ void main() {
final
double
appIconBottomPadding
=
tester
.
getTopLeft
(
appPowered
).
dy
-
tester
.
getBottomLeft
(
appIcon
).
dy
;
expect
(
appIconBottomPadding
,
18.0
);
});
testWidgets
(
'Error handling test'
,
(
WidgetTester
tester
)
async
{
LicenseRegistry
.
addLicense
(()
=>
Stream
<
LicenseEntry
>.
error
(
Exception
(
'Injected failure'
)));
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Material
(
child:
AboutListTile
())));
await
tester
.
tap
(
find
.
byType
(
ListTile
));
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
seconds:
2
));
await
tester
.
tap
(
find
.
text
(
'VIEW LICENSES'
));
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
seconds:
2
));
final
Finder
finder
=
find
.
byWidgetPredicate
((
Widget
widget
)
=>
widget
.
runtimeType
.
toString
()
==
'_PackagesView'
);
// force the stream to complete (has to be done in a runAsync block since it's areal async process)
await
tester
.
runAsync
(()
=>
(
tester
.
firstState
(
finder
)
as
dynamic
).
licenses
as
Future
<
dynamic
>);
// ignore: avoid_dynamic_calls
expect
(
tester
.
takeException
().
toString
(),
'Exception: Injected failure'
);
await
tester
.
pumpAndSettle
();
expect
(
tester
.
takeException
().
toString
(),
'Exception: Injected failure'
);
expect
(
find
.
text
(
'Exception: Injected failure'
),
findsOneWidget
);
});
}
class
FakeLicenseEntry
extends
LicenseEntry
{
...
...
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