Q:

in Flutter or any OOPls, when do you use a void or a specific data type in a method?

Im currently watching Angela Yu's tutorial in Flutter and its kinda fun and it really does help me clean up my code more and established my 4 pillars of OOP, but Im kinda confused on where I should use void or any data types  like String, Int, etc when creating a method() 
Thank you! tbh, I dont know what to typed in Google to be more specific with my question so I asked here lol. Thanks for the information that you will give me guys!

A:

When creating a method you use data types to specify the return type of the method or the type of the parameters that method takes in.
Return type means what type of data will be returned when you are invoking a method.
By Parameter type I mean, that what kind of data is taken as an input by the method.
The syntax you use to declare a method in dart:
return-type methodName(parameter's-data-type nameOfTheParameter);
Return type: 

If you declare your method with return type void it means that that method won't return anything.
If you specify the return type as dynamic or object it means that
the method can return any object or null.
If you give a specific return type to the method like String, int or
double or anything then it means that the method will return the
data of that specific type.
If there is no return statement at the end of the method then it will return null.

Parameter type:

If you declare some parameters in your method you can specify the
data type of the parameters. Specifying data type of parameter is
optional.
If you don't specify the data type of the parameter then the type is
dynamic and that method can be invoked by passing any type of parameters.
But, if you specify the type of parameter of the method then it is
compulsory to pass only that type of object to the method.

I hope this is what you were looking for, in case of any doubt please let me know. If this answer helps you then please accept and up-vote it. 

