How to display snackbar infinite duration in a flutter application

Snackbar had duration property. with this property, we can set duration like days and show infinite duration.

duration: Duration(seconds: 365),

 

showDefaultSnackbar(BuildContext context) {
  Scaffold.of(context).showSnackBar(
    SnackBar(
      content: Text('Hello from the default snackbar'),
      action: SnackBarAction(
        label: 'Click Me',
        onPressed: () {},
      ),
      duration: Duration(seconds: 365),
    ),
  );
}

 


Subscribe For Daily Updates

Flutter Questions
Android Questions