The BoxDecoration class docs show that this widget has a padding property.

Yet when I use it with this property, I get that: The named parameter 'padding' isn't defined.

I thought maybe my version of flutter was out of date, but I'm using v1.7.8+hotfix.4, which is the most recent (as of August 7th 2019), so I'm not sure how to fix this error.

My code looks something like:

  decoration: BoxDecoration(... padding: EdgeInsets.all(4.0))

Solution 1: AbsoluteSpace

As @pskink mentioned in the comments, the BoxDecoration constructor doesn't have a padding parameter, so it's determined by padding = border?.dimensions instead.

Solution 2: CookieThief

I saw that the answer above is incomplete, so here is my full example answer hope it helps. decoration: BoxDecoration() have padding property because it is a class property

          decoration: BoxDecoration(color: Colors.white),
          padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
          child: ...