title: how to create a constructor in flutter with null safety
body: <p>This got a bit tricky for me. since we can no longer pass null values in contructor I had this</p>
  <pre><code>class LeadingButton extends StatelessWidget {
    final IconData icon;
    final Color color;
    final Color iconColor;
    final double iconSize;
    final double size;
    final Color backGroundColor;
    final VoidCallback onPressed;
    final double padding;
    final EdgeInsets margin;
    final double rotate;
  
    LeadingButton({
        @required this.icon,
        this.color = Colors.transparent,
        @required this.onPressed,
        this.size = 20,
        this.backGroundColor = Colors.transparent,
        this.iconSize = 20,
        this.iconColor = darkColor,
        this.rotate = 0,
        this.padding = 0,
        this.margin = const EdgeInsets.all(10)});
  ...
  </code></pre>
  <p>I am getting an error on <code>icon</code> and <code>onpressed</code> function. although the
  documentation is saying</p>
  <blockquote>
  <p>The parameter 'onPressed' &amp; 'icon' can't have a value
  of 'null' because of its type, but the implicit default value is
  'null'. Try adding either an explicit non-'null' default value or the
  'required' modifier.</p>
  </blockquote>
  <p>I guess I am missing some thing, kindly mind to share</p>