meta 1.1.6

  • Installing
  • Versions
  • 95

Annotations for Static Analysis

This package defines annotations that can be used by the tools that are shipped with the Dart SDK.

Library Structure

The annotations in this package are defined in two libraries.

The library in meta.dart defines annotations that can be used by static analysis tools to provide a more complete analysis of the code that uses them. Within the SDK, these tools include the command-line analyzer (dartanalyzer) and the analysis server that is used to power many of the Dart-enabled development tools.

The library in dart2js.dart defines annotations that provide hints to dart2js to improve the quality of the JavaScript code that it produces. These annotations are currently experimental and might be removed in a future version of this package.


Post issues and feature requests on the GitHub issue tracker.

Questions and discussions are welcome at the Dart Analyzer Discussion Group.


See the LICENSE file.


  • Set max SDK version to <3.0.0.


  • Introduce @isTest and @isTestGroup to declare a function that is a test, or a test group.


  • Added dart2js.dart.


  • Rollback SDK constraint update for 2.0.0. No longer needed.


  • Update SDK constraint to be 2.0.0 dev friendly.


  • Introduce @alwaysThrows to declare that a function always throws (SDK issue 17999). This is first available in Dart SDK 1.25.0-dev.1.0.

      import 'package:meta/meta.dart';
      // Without knowing that [failBigTime] always throws, it looks like this
      // function might return without returning a bool.
      bool fn(expected, actual) {
        if (expected != actual)
          failBigTime(expected, actual);
          return True;
      void failBigTime(expected, actual) {
        throw new StateError('Expected $expected, but was $actual.');


  • Introduce @experimental to annotate a library, or any declaration that is part of the public interface of a library (such as top-level members, class members, and function parameters) to indicate that the annotated API is experimental and may be removed or changed at any-time without updating the version of the containing package, despite the fact that it would otherwise be a breaking change.


  • Introduce @virtual to allow field overrides in strong mode (SDK issue 27384).

      import 'package:meta/meta.dart' show virtual;
      class Base {
        @virtual int x;
      class Derived extends Base {
        int x;
        // Expose the hidden storage slot:
        int get superX => super.x;
        set superX(int v) { super.x = v; }


  • Introduce @checked to override a method and tighten a parameter type (SDK issue 25578).

      import 'package:meta/meta.dart' show checked;
      class View {
        addChild(View v) {}
      class MyView extends View {
        // this override is legal, it will check at runtime if we actually
        // got a MyView.
        addChild(@checked MyView v) {}
      main() {
        dynamic mv = new MyView();
        mv.addChild(new View()); // runtime error


  • Introduce @visibleForTesting annotation for declarations that may be referenced only in the library or in a test.


  • Updated @factory to allow statics and methods returning null.


  • First stable API release.


  • Updated @protected to include implemented interfaces (linter#252).


  • Fixed markdown in dartdocs.


  • Introduce @optionalTypeArgs annotation for classes whose type arguments are to be treated as optional.


  • Added new Required constructor with a means to specify a reason to explain why a parameter is required.


  • Introduce @factory annotation for methods that must either be abstract or must return a newly allocated object.
  • Introduce @literal annotation that indicates that any invocation of a constructor must use the keyword const unless one or more of the arguments to the constructor is not a compile-time constant.


  • Introduce @protected annotation for members that must only be called from instance members of subclasses.
  • Introduce @required annotation for optional parameters that should be treated as required.
  • Introduce @mustCallSuper annotation for methods that must be invoked by all overriding methods.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  meta: ^1.1.6

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:meta/meta.dart';
Version Uploaded Documentation Archive
1.1.6 Jul 18, 2018 Go to the documentation of meta 1.1.6 Download meta 1.1.6 archive
1.1.5 May 3, 2018 Go to the documentation of meta 1.1.5 Download meta 1.1.5 archive
1.1.2 Sep 28, 2017 Go to the documentation of meta 1.1.2 Download meta 1.1.2 archive
1.1.1 Jul 19, 2017 Go to the documentation of meta 1.1.1 Download meta 1.1.1 archive
1.1.0 Jul 10, 2017 Go to the documentation of meta 1.1.0 Download meta 1.1.0 archive
1.0.5 Mar 31, 2017 Go to the documentation of meta 1.0.5 Download meta 1.0.5 archive
1.0.4 Sep 20, 2016 Go to the documentation of meta 1.0.4 Download meta 1.0.4 archive
1.0.3 Sep 14, 2016 Go to the documentation of meta 1.0.3 Download meta 1.0.3 archive
1.0.2 Aug 15, 2016 Go to the documentation of meta 1.0.2 Download meta 1.0.2 archive
1.0.1 Jun 27, 2016 Go to the documentation of meta 1.0.1 Download meta 1.0.1 archive

All 85 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:meta/meta.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use meta.dart.

The description is too long. (-10 points)

Search engines will display only the first part of the description. Try to keep it under 180 characters.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.12.0 <3.0.0