Skip to content

Commit c453410

Browse files
Merge branch 'main' into manual-roll-2d9977c14ebe
2 parents 965624d + f1636db commit c453410

File tree

6 files changed

+35
-4
lines changed

6 files changed

+35
-4
lines changed

packages/vector_graphics/CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
## NEXT
1+
## 1.1.19
22

3-
* Updates minimum supported SDK version to Flutter 3.27/Dart 3.6.
3+
* Updates minimum supported SDK version to Flutter 3.24/Dart 3.5.
4+
* Enhance image handling by adding validity checks and clear error messages for improved robustness and maintainability.
45

56
## 1.1.18
67

packages/vector_graphics/lib/src/listener.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,12 @@ class FlutterVectorGraphicsListener extends VectorGraphicsCodecListener {
773773
@override
774774
void onDrawImage(int imageId, double x, double y, double width, double height,
775775
Float64List? transform) {
776-
final Image image = _images[imageId]!;
776+
final Image? image = _images[imageId];
777+
assert(image != null,
778+
'Invalid imageId: $imageId. Image not found in _images.');
779+
if (image == null) {
780+
return;
781+
}
777782
if (transform != null) {
778783
_canvas.save();
779784
_canvas.transform(transform);

packages/vector_graphics/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: vector_graphics
22
description: A vector graphics rendering package for Flutter using a binary encoding.
33
repository: https://github.com/flutter/packages/tree/main/packages/vector_graphics
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+vector_graphics%22
5-
version: 1.1.18
5+
version: 1.1.19
66

77
environment:
88
sdk: ^3.6.0

packages/vector_graphics/test/listener_test.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,18 @@ void main() {
144144
expect(drawParagraph1.memberName, #drawParagraph);
145145
expect((drawParagraph1.positionalArguments[1] as Offset).dx, 58);
146146
});
147+
148+
test('should assert when imageId is invalid', () async {
149+
final TestPictureFactory factory = TestPictureFactory();
150+
final FlutterVectorGraphicsListener listener =
151+
FlutterVectorGraphicsListener(
152+
pictureFactory: factory,
153+
);
154+
listener.onImage(0, 0, base64.decode(bluePngPixel));
155+
await listener.waitForImageDecode();
156+
expect(() => listener.onDrawImage(2, 10, 10, 100, 100, null),
157+
throwsAssertionError);
158+
});
147159
}
148160

149161
class TestPictureFactory implements PictureFactory {

script/tool/lib/src/drive_examples_command.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ class DriveExamplesCommand extends PackageLoopingCommand {
140140
platformWeb: <String>[
141141
'-d',
142142
'web-server',
143+
// TODO(stuartmorgan): Remove once drive works without it. See
144+
// https://github.com/dart-lang/sdk/issues/60289 and
145+
// https://github.com/flutter/flutter/pull/169174
146+
'--no-web-experimental-hot-reload',
143147
'--web-port=7357',
144148
'--browser-name=chrome',
145149
if (useWasm) '--wasm',

script/tool/test/drive_examples_command_test.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,7 @@ void main() {
840840
'drive',
841841
'-d',
842842
'web-server',
843+
'--no-web-experimental-hot-reload',
843844
'--web-port=7357',
844845
'--browser-name=chrome',
845846
'--screenshot=/path/to/logs/plugin_example-drive',
@@ -891,6 +892,7 @@ void main() {
891892
'drive',
892893
'-d',
893894
'web-server',
895+
'--no-web-experimental-hot-reload',
894896
'--web-port=7357',
895897
'--browser-name=chrome',
896898
'--wasm',
@@ -941,6 +943,7 @@ void main() {
941943
'drive',
942944
'-d',
943945
'web-server',
946+
'--no-web-experimental-hot-reload',
944947
'--web-port=7357',
945948
'--browser-name=chrome',
946949
'--screenshot=/path/to/logs/plugin_example-drive',
@@ -993,6 +996,7 @@ void main() {
993996
'drive',
994997
'-d',
995998
'web-server',
999+
'--no-web-experimental-hot-reload',
9961000
'--web-port=7357',
9971001
'--browser-name=chrome',
9981002
'--chrome-binary=/path/to/chrome',
@@ -1444,6 +1448,7 @@ void main() {
14441448
'drive',
14451449
'-d',
14461450
'web-server',
1451+
'--no-web-experimental-hot-reload',
14471452
'--web-port=7357',
14481453
'--browser-name=chrome',
14491454
'--screenshot=/path/to/logs/plugin_example-drive',
@@ -1459,6 +1464,7 @@ void main() {
14591464
'drive',
14601465
'-d',
14611466
'web-server',
1467+
'--no-web-experimental-hot-reload',
14621468
'--web-port=7357',
14631469
'--browser-name=chrome',
14641470
'--screenshot=/path/to/logs/plugin_example-drive',
@@ -1558,6 +1564,7 @@ void main() {
15581564
'drive',
15591565
'-d',
15601566
'web-server',
1567+
'--no-web-experimental-hot-reload',
15611568
'--web-port=7357',
15621569
'--browser-name=chrome',
15631570
'--screenshot=/path/to/logs/a_package_example-drive',
@@ -1603,6 +1610,7 @@ void main() {
16031610
'drive',
16041611
'-d',
16051612
'web-server',
1613+
'--no-web-experimental-hot-reload',
16061614
'--web-port=7357',
16071615
'--browser-name=chrome',
16081616
'--driver',
@@ -1682,6 +1690,7 @@ void main() {
16821690
'drive',
16831691
'-d',
16841692
'web-server',
1693+
'--no-web-experimental-hot-reload',
16851694
'--web-port=7357',
16861695
'--browser-name=chrome',
16871696
'--screenshot=/path/to/logs/a_package_example_with_web-drive',

0 commit comments

Comments
 (0)