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
08ca8b01
Unverified
Commit
08ca8b01
authored
Apr 23, 2021
by
Dan Field
Committed by
GitHub
Apr 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error resolution when a completer is already set (#81014)
parent
7b0c8267
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
23 deletions
+8
-23
image_provider.dart
packages/flutter/lib/src/painting/image_provider.dart
+5
-22
image_stream.dart
packages/flutter/lib/src/painting/image_stream.dart
+0
-1
image_provider_test.dart
packages/flutter/test/painting/image_provider_test.dart
+3
-0
No files found.
packages/flutter/lib/src/painting/image_provider.dart
View file @
08ca8b01
...
...
@@ -333,8 +333,6 @@ abstract class ImageProvider<T extends Object> {
},
(
T
?
key
,
Object
exception
,
StackTrace
?
stack
)
async
{
await
null
;
// wait an event turn in case a listener has been added to the image stream.
final
_ErrorImageCompleter
imageCompleter
=
_ErrorImageCompleter
();
stream
.
setCompleter
(
imageCompleter
);
InformationCollector
?
collector
;
assert
(()
{
collector
=
()
sync
*
{
...
...
@@ -344,7 +342,10 @@ abstract class ImageProvider<T extends Object> {
};
return
true
;
}());
imageCompleter
.
setError
(
if
(
stream
.
completer
==
null
)
{
stream
.
setCompleter
(
_ErrorImageCompleter
());
}
stream
.
completer
!.
reportError
(
exception:
exception
,
stack:
stack
,
context:
ErrorDescription
(
'while resolving an image'
),
...
...
@@ -1127,25 +1128,7 @@ class ExactAssetImage extends AssetBundleImageProvider {
}
// A completer used when resolving an image fails sync.
class
_ErrorImageCompleter
extends
ImageStreamCompleter
{
_ErrorImageCompleter
();
void
setError
({
DiagnosticsNode
?
context
,
required
Object
exception
,
StackTrace
?
stack
,
InformationCollector
?
informationCollector
,
bool
silent
=
false
,
})
{
reportError
(
context:
context
,
exception:
exception
,
stack:
stack
,
informationCollector:
informationCollector
,
silent:
silent
,
);
}
}
class
_ErrorImageCompleter
extends
ImageStreamCompleter
{}
/// The exception thrown when the HTTP request to load a network image fails.
class
NetworkImageLoadException
implements
Exception
{
...
...
packages/flutter/lib/src/painting/image_stream.dart
View file @
08ca8b01
...
...
@@ -668,7 +668,6 @@ abstract class ImageStreamCompleter with Diagnosticable {
/// messages, but errors during development will still be reported.
///
/// See [FlutterErrorDetails] for further details on these values.
@protected
@pragma
(
'vm:notify-debugger-on-exception'
)
void
reportError
({
DiagnosticsNode
?
context
,
...
...
packages/flutter/test/painting/image_provider_test.dart
View file @
08ca8b01
...
...
@@ -90,7 +90,9 @@ void main() {
await
testZone
.
run
(()
async
{
final
ImageProvider
imageProvider
=
LoadErrorCompleterImageProvider
();
final
Completer
<
bool
>
caughtError
=
Completer
<
bool
>();
final
Completer
<
bool
>
onErrorCompleter
=
Completer
<
bool
>();
FlutterError
.
onError
=
(
FlutterErrorDetails
details
)
{
onErrorCompleter
.
complete
(
true
);
throw
Error
();
};
final
ImageStream
result
=
imageProvider
.
resolve
(
ImageConfiguration
.
empty
);
...
...
@@ -99,6 +101,7 @@ void main() {
caughtError
.
complete
(
true
);
}));
expect
(
await
caughtError
.
future
,
true
);
expect
(
await
onErrorCompleter
.
future
,
true
);
});
expect
(
uncaught
,
false
);
});
...
...
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