Dart Return Values

In this tutorial you will learn about the Dart Return Values and its application with practical example.

Dart Return Values

Sometimes we may want a function to return some value to the point it where it is called from. In Dart, there is return keyword allows a function to return value. The return statement is optional, if not specified the function returns null. There can be only one return statement in a function.

Syntax:-

Dart Function With Return Value

Syntax:-

func_name :- It is replaced with the name of the function.
return_type :- It represents return_type of the function. The return_type can be any valid data type. The data type of the value returned must match the return type of the function.

Example:-

Output:-

dart_function_with_return_statement

In this tutorial we have learn about the Dart Return Values and its application with practical example. I hope you will like this tutorial.