title: Flutter: Differentiate between Widget param = null and an unset param
body: <p>I have a <code>CustomButton</code> like so:</p>
  
  <pre class="lang-dart prettyprint-override"><code>class CustomButton extends StatelessWidget {
    const CustomButton(
        {Key key, this.onPressed, this.child, this.padding})
        : super(key: key);
  
    final VoidCallback onPressed;
    final Widget child;
    final EdgeInsetsGeometry padding;
  
    @override
    Widget build(BuildContext context) {
      final defaultPadding = EdgeInsets.symmetric(vertical: 13);
      return FlatButton(
        padding: padding ?? defaultPadding,
        child: child,
        onPressed: onPressed,
        // + some irrelevant custom properties
      );
    }
  }
  
  </code></pre>
  
  <p>I've included various applications of the widget, along with the desired outcome:</p>
  
  <pre class="lang-dart prettyprint-override"><code>CustomButton(child: Text(''), onPressed: () {}) // 1⃣ no padding specified; use default
  CustomButton(..., padding: null) // 2⃣ use NO padding
  CustomButton(..., padding: EdgeInsets.only(left:1)) // 3⃣ use specified padding
  </code></pre>
  
  <p>The issue is that I can't differentiate between when <code>padding</code> is not passed  1⃣  and when <code>padding: null</code> is passed  2⃣ . In both cases, <code>defaultPadding</code> is applied -- whereas I want <code>padding: null</code> to result in no padding being applied.</p>
  
  <p>How can I do this?</p>