Property 'defaultBinaryMessenger' cannot be accessed on 'ServicesBinding?' because it is potentially null

I’m unable to run the basic flutter application that is created using the flutter create command. I got the below error when I’m trying the application.

Error: Property ‘defaultBinaryMessenger’ cannot be accessed on ‘ServicesBinding?’ because it is potentially null.

  • ‘ServicesBinding’ is from ‘package:flutter/src/services/binding.dart’ (’/C:/src/flutter/packages/flutter/lib/src/services/binding.dart’).
    Try accessing using ?. instead.
    _binaryMessenger ?? ServicesBinding.instance.defaultBinaryMessenger;