OLD | NEW |
(Empty) | |
| 1 ## 1.1.1 |
| 2 * Update SDK constraint to be 2.0.0 dev friendly. |
| 3 |
| 4 ## 1.1.0 |
| 5 * Introduce `@alwaysThrows` to declare that a function always throws |
| 6 (SDK issue [17999](https://github.com/dart-lang/sdk/issues/17999)). This |
| 7 is first available in Dart SDK 1.25.0-dev.1.0. |
| 8 |
| 9 ```dart |
| 10 import 'package:meta/meta.dart'; |
| 11 |
| 12 // Without knowing that [failBigTime] always throws, it looks like this |
| 13 // function might return without returning a bool. |
| 14 bool fn(expected, actual) { |
| 15 if (expected != actual) |
| 16 failBigTime(expected, actual); |
| 17 else |
| 18 return True; |
| 19 } |
| 20 |
| 21 @alwaysThrows |
| 22 void failBigTime(expected, actual) { |
| 23 throw new StateError('Expected $expected, but was $actual.'); |
| 24 } |
| 25 ``` |
| 26 |
| 27 ## 1.0.4 |
| 28 * Introduce `@virtual` to allow field overrides in strong mode |
| 29 (SDK issue [27384](https://github.com/dart-lang/sdk/issues/27384)). |
| 30 |
| 31 ```dart |
| 32 import 'package:meta/meta.dart' show virtual; |
| 33 class Base { |
| 34 @virtual int x; |
| 35 } |
| 36 class Derived extends Base { |
| 37 int x; |
| 38 |
| 39 // Expose the hidden storage slot: |
| 40 int get superX => super.x; |
| 41 set superX(int v) { super.x = v; } |
| 42 } |
| 43 ``` |
| 44 |
| 45 ## 1.0.3 |
| 46 * Introduce `@checked` to override a method and tighten a parameter |
| 47 type (SDK issue [25578](https://github.com/dart-lang/sdk/issues/25578)). |
| 48 |
| 49 ```dart |
| 50 import 'package:meta/meta.dart' show checked; |
| 51 class View { |
| 52 addChild(View v) {} |
| 53 } |
| 54 class MyView extends View { |
| 55 // this override is legal, it will check at runtime if we actually |
| 56 // got a MyView. |
| 57 addChild(@checked MyView v) {} |
| 58 } |
| 59 main() { |
| 60 dynamic mv = new MyView(); |
| 61 mv.addChild(new View()); // runtime error |
| 62 } |
| 63 ``` |
| 64 |
| 65 ## 1.0.2 |
| 66 * Introduce `@visibleForTesting` annotation for declarations that may be referen
ced only in the library or in a test. |
| 67 |
| 68 ## 1.0.1 |
| 69 * Updated `@factory` to allow statics and methods returning `null`. |
| 70 |
| 71 ## 1.0.0 |
| 72 * First stable API release. |
| 73 |
| 74 ## 0.12.2 |
| 75 * Updated `@protected` to include implemented interfaces (linter#252). |
| 76 |
| 77 ## 0.12.1 |
| 78 * Fixed markdown in dartdocs. |
| 79 |
| 80 ## 0.12.0 |
| 81 * Introduce `@optionalTypeArgs` annotation for classes whose type arguments are
to be treated as optional. |
| 82 |
| 83 ## 0.11.0 |
| 84 * Added new `Required` constructor with a means to specify a reason to explain w
hy a parameter is required. |
| 85 |
| 86 ## 0.10.0 |
| 87 * Introduce `@factory` annotation for methods that must either be abstract or |
| 88 must return a newly allocated object. |
| 89 * Introduce `@literal` annotation that indicates that any invocation of a |
| 90 constructor must use the keyword `const` unless one or more of the |
| 91 arguments to the constructor is not a compile-time constant. |
| 92 |
| 93 ## 0.9.0 |
| 94 * Introduce `@protected` annotation for members that must only be called from |
| 95 instance members of subclasses. |
| 96 * Introduce `@required` annotation for optional parameters that should be treate
d |
| 97 as required. |
| 98 * Introduce `@mustCallSuper` annotation for methods that must be invoked by all |
| 99 overriding methods. |
OLD | NEW |