OLD | NEW |
1 ## 1.24.0 | 1 ## 1.24.0 |
2 | 2 |
3 ### Language | 3 ### Language |
4 * During a dynamic type check, `void` is not required to be `null` anymore. | 4 * During a dynamic type check, `void` is not required to be `null` anymore. |
5 In practice, this makes overriding `void` functions with non-`void` functions | 5 In practice, this makes overriding `void` functions with non-`void` functions |
6 safer. | 6 safer. |
7 * During static analysis, a function or setter declared using `=>` with return | 7 * During static analysis, a function or setter declared using `=>` with return |
8 type `void` now allows the returned expression to have any type. For example, | 8 type `void` now allows the returned expression to have any type. For example, |
9 assuming the declaration `int x;`, it is now type correct to have | 9 assuming the declaration `int x;`, it is now type correct to have |
10 `void f() => ++x;`. | 10 `void f() => ++x;`. |
| 11 * A new function-type syntax has been added to the language. |
| 12 Intuitively, the type of a function can be constructed by textually replacing |
| 13 the function's name with `Function` in its declaration. For instance, the |
| 14 type of `void foo() {}` would be `void Function()`. The new syntax may be used |
| 15 wherever a type can be written. It is thus now possible to declare fields |
| 16 containing functions without needing to write typedefs: `void Function() x;`. |
| 17 The new function type has one restriction: it may not contain the old-style |
| 18 function-type syntax for its parameters. The following is thus |
| 19 illegal: `void Function(int f())`. |
| 20 `typedefs` have been updated to support this new syntax. |
| 21 Examples: |
| 22 ``` |
| 23 typedef F = void Function(); // F is the name for a `void` callback. |
| 24 int Function(int) f; // A field `f` that contains an int->int function. |
| 25 |
| 26 class A<T> { |
| 27 // The parameter `callback` is a function that takes a `T` and returns |
| 28 // `void`. |
| 29 void forEach(void Function(T) callback); |
| 30 } |
| 31 |
| 32 // The new function type supports generic arguments. |
| 33 typedef Invoker = T Function<T>(T Function() callback); |
| 34 ``` |
11 | 35 |
12 #### Strong Mode | 36 #### Strong Mode |
13 | 37 |
14 * Removed ad hoc Future.then inference in favor of using FutureOr. Prior to | 38 * Removed ad hoc Future.then inference in favor of using FutureOr. Prior to |
15 adding FutureOr to the language, the analyzer implented an ad hoc type inference | 39 adding FutureOr to the language, the analyzer implented an ad hoc type inference |
16 for Future.then (and overrides) treating it as if the onValue callback was typed | 40 for Future.then (and overrides) treating it as if the onValue callback was typed |
17 to return FutureOr for the purposes of inference. This ad hoc inference has | 41 to return FutureOr for the purposes of inference. This ad hoc inference has |
18 been removed now that FutureOr has been added. | 42 been removed now that FutureOr has been added. |
19 | 43 |
20 Packages that implement `Future` must either type the `onValue` parameter to | 44 Packages that implement `Future` must either type the `onValue` parameter to |
21 `.then` as returning `FutureOr<T>`, or else must leave the type of the parameter | 45 `.then` as returning `FutureOr<T>`, or else must leave the type of the parameter |
22 entirely to allow inference to fill in the type. | 46 entirely to allow inference to fill in the type. |
23 | 47 |
24 * The following is also a change in strong mode: During static analysis, a | 48 * The following is also a change in strong mode: During static analysis, a |
25 function or setter declared using `=>` with return type `void` now allows the | 49 function or setter declared using `=>` with return type `void` now allows the |
26 returned expression to have any type. | 50 returned expression to have any type. |
| 51 * The new function-type syntax is also supported by strong mode. |
27 | 52 |
28 ### Core library changes | 53 ### Core library changes |
29 | 54 |
30 * `dart:io` | 55 * `dart:io` |
31 * Added `Platform.localeName`, needed for accessing the locale on platforms | 56 * Added `Platform.localeName`, needed for accessing the locale on platforms |
32 that don't store it in an environment variable. | 57 that don't store it in an environment variable. |
33 * Added `ProcessInfo.currentRss` and `ProcessInfo.maxRss` for inspecting | 58 * Added `ProcessInfo.currentRss` and `ProcessInfo.maxRss` for inspecting |
34 the Dart VM process current and peak resident set size. | 59 the Dart VM process current and peak resident set size. |
35 * Added 'RawSynchronousSocket', a basic synchronous socket implementation. | 60 * Added 'RawSynchronousSocket', a basic synchronous socket implementation. |
36 * `dart:convert` | 61 * `dart:convert` |
(...skipping 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1917 they will keep the Dart process alive until they time out. This fixes the | 1942 they will keep the Dart process alive until they time out. This fixes the |
1918 handling of persistent connections. Previously, the client would shut down | 1943 handling of persistent connections. Previously, the client would shut down |
1919 immediately after a request. | 1944 immediately after a request. |
1920 | 1945 |
1921 * **Breaking change:** `HttpServer` no longer compresses all traffic by | 1946 * **Breaking change:** `HttpServer` no longer compresses all traffic by |
1922 default. The new `autoCompress` property can be set to `true` to re-enable | 1947 default. The new `autoCompress` property can be set to `true` to re-enable |
1923 compression. | 1948 compression. |
1924 | 1949 |
1925 * `dart:isolate`: `Isolate.spawnUri` added the optional `packageRoot` argument, | 1950 * `dart:isolate`: `Isolate.spawnUri` added the optional `packageRoot` argument, |
1926 which controls how it resolves `package:` URIs. | 1951 which controls how it resolves `package:` URIs. |
OLD | NEW |