@@ -13,9 +13,9 @@ typedef ImageSourceMatcher = bool Function(
1313
1414final _dataUriFormat = RegExp ("^(?<scheme>data):(?<mime>image\/ [\\ w\+\-\. ]+)(?<encoding>;base64)?\, (?<data>.*)" );
1515
16- ImageSourceMatcher dataUriMatcher ({String encoding = 'base64' , String mime}) => (attributes, element) {
16+ ImageSourceMatcher dataUriMatcher ({String ? encoding = 'base64' , String ? mime}) => (attributes, element) {
1717 if (_src (attributes) == null ) return false ;
18- final dataUri = _dataUriFormat.firstMatch (_src (attributes));
18+ final dataUri = _dataUriFormat.firstMatch (_src (attributes)! );
1919 return dataUri != null &&
2020 (mime == null || dataUri.namedGroup ('mime' ) == mime) &&
2121 (encoding == null || dataUri.namedGroup ('encoding' ) == ';$encoding ' );
@@ -164,9 +164,10 @@ ImageRender networkImageRender({
164164 };
165165
166166ImageRender 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' ) {
170171 final decodedImage = base64.decode (data.trim ());
171172 return SvgPicture .memory (
172173 decodedImage,
0 commit comments