flutter_svg icon indicating copy to clipboard operation
flutter_svg copied to clipboard

Why the ! operator on message in provideSvg?

Open Albert221 opened this issue 2 years ago • 1 comments

Hi!

I created my own SvgNetworkLoader extending it. In overriden prepareMessage I return null on some network failures, as the return type was Future<Uint8List?>.

But looks like returning null is illegal here, because in loaders.dart:361 the library uses ! on it:

  String provideSvg(Uint8List? message) => utf8.decode(message!);

Which results in an unhandled exception. I propose to either change return type of prepareMessage or handle nulls there.

Albert221 avatar Mar 20 '23 09:03 Albert221

Agreed this is a problem. Probably related to #250

dnfield avatar Mar 20 '23 19:03 dnfield