Skip to content

Commit 28a1d0b

Browse files
Update image.error_builder.0.dart to replace the emoji with some text (flutter#176886)
fixes flutter#174805 after some investigation i found that `dart doc ` only understands `utf-8 encoding` so providing an `emoji` for example breaks it(no crash but not the intended behavior). ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --------- Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
1 parent 9dff19e commit 28a1d0b

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

examples/api/lib/widgets/image/image.error_builder.0.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ErrorBuilderExample extends StatelessWidget {
3939
// exception,
4040
// stackTrace,
4141
// );
42-
return const Text('😢');
42+
return const Text('Image failed to load');
4343
},
4444
),
4545
);

examples/api/test/widgets/image/image.error_builder.0_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void main() {
2525
expect(imageProvider.url, equals('https://example.does.not.exist/image.jpg'));
2626
});
2727

28-
testWidgets('errorBuilder returns text with emoji', (WidgetTester tester) async {
28+
testWidgets('errorBuilder returns text', (WidgetTester tester) async {
2929
await tester.pumpWidget(const example.ErrorBuilderExampleApp());
3030
await tester.pumpAndSettle();
3131

@@ -35,7 +35,7 @@ void main() {
3535

3636
expect(
3737
errorBuilder(context, const HttpException('oops'), StackTrace.empty),
38-
isA<Text>().having((Text text) => text.data, 'data', equals('😢')),
38+
isA<Text>().having((Text text) => text.data, 'data', equals('Image failed to load')),
3939
);
4040
});
4141
}

packages/flutter/lib/src/widgets/image.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,8 +869,9 @@ class Image extends StatefulWidget {
869869
/// the exception by providing a replacement widget, or rethrow the exception.
870870
///
871871
/// {@tool dartpad}
872-
/// The following sample uses [errorBuilder] to show a '😢' in place of the
873-
/// image that fails to load, and prints the error to the console.
872+
/// The following sample uses [errorBuilder] to show 'Image
873+
/// failed to load' in place of the image that fails to load, and prints
874+
/// the error to the console.
874875
///
875876
/// ** See code in examples/api/lib/widgets/image/image.error_builder.0.dart **
876877
/// {@end-tool}

0 commit comments

Comments
 (0)