doNotSubmit top-level constant

_DoNotSubmit const doNotSubmit

Used to annotate an optional parameter, method, getter or top-level getter or function that is not intended to be accessed in checked-in code, but might be ephemerally used during development or local testing.

The intention of this annotation is to signify an API is available for temporary or ephemeral use (such as debugging or local testing), but should be removed before the code is submitted or merged into a tested branch of the repository (e.g. main or similar).

For example:

void test(
  String name,
  void Function() testFunction, {
  @doNotSubmit bool skip = false,
}) { /* ... */ }

void main() {
  // OK.
  test('foo', () => print('foo'));

  // HINT: Remove before submitting.
  test('bar', () => print('bar'), skip: true);
}

Tools, such as the analyzer, can provide feedback if

  • a declaration that has this annotation is referenced anywhere, including the library in which it is declared, in checked-in code. Exceptions are being referenced by a declaration that is also annotated with @doNotSubmit or referencing a parameter that is annotated with @doNotSubmit in the same method or function.

Implementation

const _DoNotSubmit doNotSubmit = _DoNotSubmit();