Dart Default value Parameters | RRTutors

Dart Default Value Parameters

If we didn't pass parameter to function call we can define a default value to the parameters

 

main(List<String> args) {

  var name = fullName(firstName: 'Chandu');

  print(name);

}

fullName({String firstName, String lastName = "Shekar"}) {

  return "$firstName $lastName";

}

Advertisements