LunaGao / flag_flutter

flag icons
https://pub.dev/packages/flag
BSD 2-Clause "Simplified" License
63 stars 60 forks source link

FormatException with Malta 4x3 svg #71

Closed Sedemicra closed 1 year ago

Sedemicra commented 2 years ago

Out of ~25 or so flags I use, one is cousing trouble - Malta:

Web:

======== Exception caught by SVG ===================================================================
The following FormatException was thrown resolving a single-frame picture stream:
Invalid double
1pt

When the exception was thrown, this was the stack: 
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 251:49  throw_
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 214:5             parse
packages/flutter_svg/src/utilities/numbers.dart 23:17                                                                      parseDouble
packages/flutter_svg/src/svg/parser_state.dart 1065:27                                                                     parseDoubleWithUnits
packages/flutter_svg/src/svg/parser_state.dart 1357:13                                                                     parseStroke
packages/flutter_svg/src/svg/parser_state.dart 1590:15                                                                     parseStyle
packages/flutter_svg/src/svg/parser_state.dart 955:7                                                                       addShape
packages/flutter_svg/src/svg/parser_state.dart 985:12                                                                      startElement
packages/flutter_svg/src/svg/parser_state.dart 881:13                                                                      parse
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50            <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1685:54                                          runUnary
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 159:18                                    handleValue
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 766:44                                    handleValueCallback
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 795:13                                    _propagateToListeners
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 465:9                                     callback
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 40:11                              _microtaskLoop
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 49:5                               _startMicrotaskLoop
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15           <fn>
Picture provider: ExactAssetPicture(name: "packages/flag/res/4x3/mt.svg", bundle: null, colorFilter: null)
Picture key: AssetBundlePictureKey(bundle: PlatformAssetBundle#6e2bc(), name: "packages/flag/res/4x3/mt.svg", colorFilter: null, theme: SvgTheme(currentColor: null, fontSize: 14, xHeight: 7))
====================================================================================================

Android:

======== Exception caught by SVG ===================================================================
The following FormatException was thrown resolving a single-frame picture stream:
Invalid double
1pt

When the exception was thrown, this was the stack: 
#0      double.parse (dart:core-patch/double_patch.dart:111:28)
#1      parseDouble (package:flutter_svg/src/utilities/numbers.dart:23:17)
#2      SvgParserState.parseDoubleWithUnits (package:flutter_svg/src/svg/parser_state.dart:1065:27)
#3      SvgParserState.parseStroke (package:flutter_svg/src/svg/parser_state.dart:1357:13)
#4      SvgParserState.parseStyle (package:flutter_svg/src/svg/parser_state.dart:1590:15)
#5      SvgParserState.addShape (package:flutter_svg/src/svg/parser_state.dart:955:7)
#6      SvgParserState.startElement (package:flutter_svg/src/svg/parser_state.dart:985:12)
#7      SvgParserState.parse (package:flutter_svg/src/svg/parser_state.dart:881:13)
<asynchronous suspension>
#8      SvgParser.parse (package:flutter_svg/parser.dart:27:12)
<asynchronous suspension>
#9      Svg.fromSvgString (package:flutter_svg/svg.dart:139:12)
<asynchronous suspension>
#10     Svg.svgPictureStringDecoder (package:flutter_svg/svg.dart:90:34)
<asynchronous suspension>
Picture provider: ExactAssetPicture(name: "packages/flag/res/4x3/mt.svg", bundle: null, colorFilter: null)
Picture key: AssetBundlePictureKey(bundle: PlatformAssetBundle#7afac(), name: "packages/flag/res/4x3/mt.svg", colorFilter: null, theme: SvgTheme(currentColor: null, fontSize: 14.0, xHeight: 7.0))
====================================================================================================
XiXiongMaoXiong commented 2 years ago

Solution is this https://github.com/LunaGao/flag_flutter/issues/74#issuecomment-1183360580 at the moment