@@ -13,9 +13,9 @@ typedef ImageSourceMatcher = bool Function(
13
13
14
14
final _dataUriFormat = RegExp ("^(?<scheme>data):(?<mime>image\/ [\\ w\+\-\. ]+)(?<encoding>;base64)?\, (?<data>.*)" );
15
15
16
- ImageSourceMatcher dataUriMatcher ({String encoding = 'base64' , String mime}) => (attributes, element) {
16
+ ImageSourceMatcher dataUriMatcher ({String ? encoding = 'base64' , String ? mime}) => (attributes, element) {
17
17
if (_src (attributes) == null ) return false ;
18
- final dataUri = _dataUriFormat.firstMatch (_src (attributes));
18
+ final dataUri = _dataUriFormat.firstMatch (_src (attributes)! );
19
19
return dataUri != null &&
20
20
(mime == null || dataUri.namedGroup ('mime' ) == mime) &&
21
21
(encoding == null || dataUri.namedGroup ('encoding' ) == ';$encoding ' );
@@ -164,9 +164,10 @@ ImageRender networkImageRender({
164
164
};
165
165
166
166
ImageRender svgDataImageRender () => (context, attributes, element) {
167
- final dataUri = _dataUriFormat.firstMatch (_src (attributes));
168
- final data = dataUri.namedGroup ('data' );
169
- if (dataUri.namedGroup ('encoding' ) == ';base64' ) {
167
+ final dataUri = _dataUriFormat.firstMatch (_src (attributes)! );
168
+ final data = dataUri? .namedGroup ('data' );
169
+ if (data == null ) return null ;
170
+ if (dataUri? .namedGroup ('encoding' ) == ';base64' ) {
170
171
final decodedImage = base64.decode (data.trim ());
171
172
return SvgPicture .memory (
172
173
decodedImage,
0 commit comments