@@ -124,8 +124,10 @@ flutter_gen:
124124 output : lib/gen/ # Optional (default: lib/gen/)
125125 lineLength : 80 # Optional (default: 80)
126126
127+ # Optional
127128 integrations :
128129 flutter_svg : true
130+ flare_flutter : true
129131
130132 colors :
131133 inputs :
@@ -161,6 +163,7 @@ flutter:
161163 - assets/images/chip4/chip.jpg
162164 - assets/images/icons/paint.svg
163165 - assets/json/fruits.json
166+ - assets/flare/Penguin.flr
164167 - pictures/ocean_view.jpg
165168` ` `
166169
@@ -217,6 +220,15 @@ Widget build(BuildContext context) {
217220}
218221` ` `
219222
223+ **Available Integrations**
224+
225+ |Packages|File extension|Setting|Usage|
226+ |--|--|--|--|
227+ |[flutter_svg](https://pub.dev/packages/flutter_svg)|.svg| `flutter_svg : true` |Assets.images.icons.paint.**svg()**|
228+ |[flare_flutter](https://pub.dev/packages/flare_flutter)|.flr| `flare_flutter : true` |Assets.flare.penguin.**flare()**|
229+
230+ <br/>
231+
220232In other cases, the asset is generated as String class.
221233
222234` ` ` dart
@@ -268,13 +280,21 @@ pictures/ocean_view.jpg => Assets.pictures.oceanView
268280import 'package:flutter/widgets.dart';
269281import 'package:flutter_svg/flutter_svg.dart';
270282import 'package:flutter/services.dart';
283+ import 'package:flare_flutter/flare_actor.dart';
284+ import 'package:flare_flutter/flare_controller.dart';
271285
272286class $PicturesGen {
273287 const $PicturesGen();
274288
275289 AssetGenImage get chip5 => const AssetGenImage('pictures/chip5.jpg');
276290}
277291
292+ class $AssetsFlareGen {
293+ const $AssetsFlareGen();
294+
295+ FlareGenImage get penguin => const FlareGenImage('assets/flare/Penguin.flr');
296+ }
297+
278298class $AssetsImagesGen {
279299 const $AssetsImagesGen();
280300
@@ -293,6 +313,18 @@ class $AssetsJsonGen {
293313 String get fruits => 'assets/json/fruits.json';
294314}
295315
316+ class $AssetsMovieGen {
317+ const $AssetsMovieGen();
318+
319+ String get theEarth => 'assets/movie/the_earth.mp4';
320+ }
321+
322+ class $AssetsUnknownGen {
323+ const $AssetsUnknownGen();
324+
325+ String get unknownMimeType => 'assets/unknown/unknown_mime_type.bk';
326+ }
327+
296328class $AssetsImagesChip3Gen {
297329 const $AssetsImagesChip3Gen();
298330
@@ -319,8 +351,11 @@ class $AssetsImagesIconsGen {
319351class Assets {
320352 Assets._();
321353
354+ static const $AssetsFlareGen flare = $AssetsFlareGen();
322355 static const $AssetsImagesGen images = $AssetsImagesGen();
323356 static const $AssetsJsonGen json = $AssetsJsonGen();
357+ static const $AssetsMovieGen movie = $AssetsMovieGen();
358+ static const $AssetsUnknownGen unknown = $AssetsUnknownGen();
324359 static const $PicturesGen pictures = $PicturesGen();
325360}
326361
@@ -331,6 +366,7 @@ class AssetGenImage extends AssetImage {
331366 final String _assetName;
332367
333368 Image image({
369+ Key key,
334370 ImageFrameBuilder frameBuilder,
335371 ImageLoadingBuilder loadingBuilder,
336372 ImageErrorWidgetBuilder errorBuilder,
@@ -350,6 +386,7 @@ class AssetGenImage extends AssetImage {
350386 FilterQuality filterQuality = FilterQuality.low,
351387 }) {
352388 return Image(
389+ key: key,
353390 image: this,
354391 frameBuilder: frameBuilder,
355392 loadingBuilder: loadingBuilder,
@@ -380,6 +417,7 @@ class SvgGenImage {
380417 final String _assetName;
381418
382419 SvgPicture svg({
420+ Key key,
383421 bool matchTextDirection = false,
384422 AssetBundle bundle,
385423 String package,
@@ -397,6 +435,7 @@ class SvgGenImage {
397435 }) {
398436 return SvgPicture.asset(
399437 _assetName,
438+ key: key,
400439 matchTextDirection: matchTextDirection,
401440 bundle: bundle,
402441 package: package,
@@ -417,6 +456,47 @@ class SvgGenImage {
417456 String get path => _assetName;
418457}
419458
459+ class FlareGenImage {
460+ const FlareGenImage(this._assetName);
461+
462+ final String _assetName;
463+
464+ FlareActor flare({
465+ String boundsNode,
466+ String animation,
467+ BoxFit fit = BoxFit.contain,
468+ Alignment alignment = Alignment.center,
469+ bool isPaused = false,
470+ bool snapToEnd = false,
471+ FlareController controller,
472+ FlareCompletedCallback callback,
473+ Color color,
474+ bool shouldClip = true,
475+ bool sizeFromArtboard = false,
476+ String artboard,
477+ bool antialias = true,
478+ }) {
479+ return FlareActor(
480+ _assetName,
481+ boundsNode: boundsNode,
482+ animation: animation,
483+ fit: fit,
484+ alignment: alignment,
485+ isPaused: isPaused,
486+ snapToEnd: snapToEnd,
487+ controller: controller,
488+ callback: callback,
489+ color: color,
490+ shouldClip: shouldClip,
491+ sizeFromArtboard: sizeFromArtboard,
492+ artboard: artboard,
493+ antialias: antialias,
494+ );
495+ }
496+
497+ String get path => _assetName;
498+ }
499+
420500```
421501
422502</p >
0 commit comments