dart-lang / site-www

Source for Dart website
https://dart.dev
Other
935 stars 675 forks source link

Add section on Function type declarations to 'Functions' page #5901

Open mmcdon20 opened 3 weeks ago

mmcdon20 commented 3 weeks ago

Page URL

https://dart.dev/language/functions/

Page source

https://github.com/dart-lang/site-www/tree/main/src/content/language/functions.md

Describe the problem

The functions page doesn't explain Function type declarations.

In contrast, the records page does explain record types for example.

Expected fix

Add some explanation about how to use Function type declarations. (Including defining return types, parameter types, etc).

It might also be worth mentioning Function types on the built-in types page.

Additional context

No response

I would like to fix this problem.

RikinR commented 2 weeks ago

If no one is working on it I would like to work on this issue

RikinR commented 1 week ago

hey ! by types of functions we are talking about static , getter & setter , constructors , anonymous and lamda functions right ?

mmcdon20 commented 1 week ago

I was referring to the type declaration for a Function.

int add(int a, int b) => a + b;

int Function(int, int) f = add;

In the above code, f is the type int Function(int, int).

RikinR commented 1 day ago

Hey ! I have submitted the PR .