@@ -500,6 +500,28 @@ Iterable<int> naturalsDownFrom(int n) sync* {
500
500
}
501
501
```
502
502
503
+ ## External functions {#external}
504
+
505
+ An external function is a function whose body is implemented separately from its
506
+ declaration. Include the ` external ` keyword before a function declaration, like so:
507
+
508
+ ``` dart
509
+ external void someFunc(int i);
510
+ ```
511
+
512
+ An external function's implementation can come from another Dart library,
513
+ or, more commonly, from another language. In interop contexts, ` external `
514
+ introduces type information for foreign functions or values,
515
+ making them usable in Dart. Implementation and usage is
516
+ heavily platform specific, so check out the interop docs on, for example,
517
+ [ C] [ ] or [ JavaScript] [ ] to learn more.
518
+
519
+ External functions can be top-level functions, [ instance methods] [ ] ,
520
+ [ getters or setters] [ ] , or [ non-redirecting constructors] [ ] .
521
+ An [ instance variable] [ ] can be ` external ` too,
522
+ which is equivalent to an external getter and (if the variable
523
+ is not ` final ` ) an external setter.
524
+
503
525
[ `Iterable` ] : {{site.dart-api}}/{{site.data.pkg-vers.SDK.channel}}/dart-core/Iterable-class.html
504
526
[ `Stream` ] : {{site.dart-api}}/{{site.data.pkg-vers.SDK.channel}}/dart-async/Stream-class.html
505
527
[ record ] : /language/records#multiple-returns
@@ -511,3 +533,10 @@ Iterable<int> naturalsDownFrom(int n) sync* {
511
533
[ conditional expression ] : /language/operators#conditional-expressions
512
534
[ Flutter ] : {{site.flutter}}
513
535
[ trailing commas ] : /language/collections#lists
536
+
537
+ [ instance methods ] : /language/methods#instance-methods
538
+ [ getters or setters ] : /language/methods#getters-and-setters
539
+ [ non-redirecting constructors ] : /language/constructors#redirecting-constructors
540
+ [ instance variable ] : /language/classes#instance-variables
541
+ [ C ] : /interop/c-interop
542
+ [ JavaScript ] : /interop/js-interop
0 commit comments