dnfield / flutter_svg

SVG parsing, rendering, and widget library for Flutter
MIT License
1.68k stars 459 forks source link

AssetBytesLoader can't be assigned to Parameter PictureProvider<dynamic, dynamic> #844

Closed buehler closed 1 year ago

buehler commented 1 year ago

Hi there!

While using the flutter svg package, I tried to use prebuilt binary svgs to ensure fast performance :-) When I tried to use the described way:


import 'package:flutter_svg/flutter_svg.dart';
import 'package:vector_graphics/vector_graphics.dart';

final Widget svg = SvgPicture(
  const AssetBytesLoader('assets/foo.svg.vec')
);

I came across the following issue:

A loader that retrieves bytes from an [AssetBundle].

See [AssetBytesLoader].

The argument type 'AssetBytesLoader' can't be assigned to the parameter type 'PictureProvider<dynamic, dynamic>'.dart[argument_type_not_assignable](https://dart.dev/diagnostics/argument_type_not_assignable)

It seems not possible to use asset bytes loader as picture provider anymore (as stated in the docs).

Did I do something wrong?

Regards

dnfield commented 1 year ago

In that case, just use the VectorGraphic API directly from package:vector_graphics.

buehler commented 1 year ago

Oh nice, thank you. This means, no need for "flutter-svg"?

dnfield commented 1 year ago

Right