SnackBar withAnimation(Animation<double> newAnimation, { Key fallbackKey })

Creates a copy of this snack bar but with the animation replaced with the given animation.

If the original snack bar lacks a key, the newly created snack bar will use the given fallback key.

Source

SnackBar withAnimation(Animation<double> newAnimation, { Key fallbackKey }) {
  return new SnackBar(
    key: key ?? fallbackKey,
    content: content,
    backgroundColor: backgroundColor,
    action: action,
    duration: duration,
    animation: newAnimation
  );
}