RiveAnimation.asset constructor

const RiveAnimation.asset(
  1. String asset, {
  2. String? artboard,
  3. List<String> animations = const [],
  4. List<String> stateMachines = const [],
  5. BoxFit? fit,
  6. Alignment? alignment,
  7. Widget? placeHolder,
  8. bool antialiasing = true,
  9. bool useArtboardSize = false,
  10. Rect? clipRect,
  11. List<RiveAnimationController> controllers = const [],
  12. OnInitCallback? onInit,
  13. RiveHitTestBehavior behavior = RiveHitTestBehavior.opaque,
  14. ObjectGenerator? objectGenerator,
  15. Key? key,
})

Creates a new RiveAnimation from an asset bundle.

Example:

return RiveAnimation.asset('assets/truck.riv');

Implementation

const RiveAnimation.asset(
  String asset, {
  this.artboard,
  this.animations = const [],
  this.stateMachines = const [],
  this.fit,
  this.alignment,
  this.placeHolder,
  this.antialiasing = true,
  this.useArtboardSize = false,
  this.clipRect,
  this.controllers = const [],
  this.onInit,
  this.behavior = RiveHitTestBehavior.opaque,
  this.objectGenerator,
  Key? key,
})  : name = asset,
      file = null,
      headers = null,
      src = _Source.asset,
      super(key: key);