I moved to stable flutter channel from beta, after upgrading flutter,

I am getting error for ListTile() attributes and ScaffoldMassanger,

 child: ListTile(
        horizontalTitleGap: 10, // error
        minVerticalPadding: 10, // error

    content: Text('success'),
    duration: Duration(seconds: 2),

I tried below solutions:

 flutter upgrade
 flutter clean
 flutter pub get
 reinstalled dart and flutter plugin in VSCode
 flutter run
 updated vscode

no success

error log after removing depreciated attributes,

lib/widgets/list_expense.dart:32:9: Error: The getter 'ScaffoldMessenger' isn't defined for the class '_ListExpenseState'.

  • '_ListExpenseState' is from 'package:XpenseTracker/widgets/list_expense.dart' ('lib/widgets/list_expense.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'ScaffoldMessenger'. ScaffoldMessenger.of(context).showSnackBar(SnackBar(

Solution 1: Dan Gerchcovich

These properties have been removed, as can be seen in the class (ListTile) documentation: https://api.flutter.dev/flutter/material/ListTile/ListTile.html

Please take a look at this package here, in order to use these properties: https://pub.dev/packages/list_tile_more_customizable

[EDIT] For your Scaffold issue please try to use a static helper function like so, then pass the string to render, along with the BuildContext:

 static Future showSimpleSnackBar(
      String message, GlobalKey<ScaffoldState> contextState) async {
      final snackBar = SnackBar(
        content: Text(message),
        duration: Duration(seconds: 3),
        action: SnackBarAction(
          label: "Got it",
          onPressed: () {
            //invoke an action here...


Make sure as well that the BuildContext is coming from a Global ScaffoldKey, and that the scaffold will be responsible with rendering the snackbar.