build method Null safety

  1. @override
Widget build(
  1. BuildContext context
)
override

An AnimatedGradient is not intended to be built directly like a true Widget. Instead opt to observe for the direct Gradient- type output.

This build() method will return a DecoratedBox whose gradient is set to observe.

Implementation

@override
Widget build(BuildContext context) {
  // assert(
  //   false,
  //   'An [AnimatedGradient] is not intended to be built directly '
  //   'like a true Widget. \nInstead opt to [AnimatedGradient.observe] '
  //   'for the direct [Gradient]-type output.',
  // );
  return DecoratedBox(decoration: BoxDecoration(gradient: observe));
}