Parameter Passing Types — Dart
The two most basic kinds of argument are Positional Arguments
and Named Arguments
In this article we shall be discussing about the basic difference between these two argument types and the scenario of where to apply them.
Video Tutorial
Implementation
Positional Arguments:
- In Case of
Positional Arguments
the order in which the data is being passed must not be changed [In our case (from below image) the first argument is of typeString
and the next argument is of typeDouble
so in the function-call also we need to follow this order,String
followed byDouble
]. - And the next rule is, all arguments are required by default. [As we have defined
String
andDouble
in our function, both the values need to be passed during the function-call. No argument is optional unless specified].
Named Arguments:
Note: Differ by curly bracket in the Function Definition.
- In Case of
Named Arguments
the order in which the data is being passed can be changed. - And all the arguments are optional by default.(i.e., we can either pass the argument value or leave it empty unless it takes a null value).
👨💻Get the complete Source Code here 👉🏻: https://github.com/vijayinyoutube/dartarguments
Other articles you may like.,
🔵Setting up your Flutter app for publishing in Play Store.
🔴Confetti Animation in Flutter
🟡 Change App Launcher Icon in Flutter
🔴 AnimatedContainer Widget in Flutter
Flutter Tutorials
If you want to know more about Flutter and various Widgets in Flutter…?🤓 Then visit my channel vijaycreations🚩
Thanks.,