Skip to content

Add a TODO function that can be assigned to all types. #60582

Open
@rensPols

Description

@rensPols

It would be great to be able to pass a todo() function as an argument to make the compiler happy while you're testing/working on something else.
Kotlin already has such a function.

I've created my own function that does this, but since it is not native, it is not integrated with any IDE features concerning the TODO's in code.

// Optional reason
/// This function can be placed on a variable or parameter whose value is yet to be implemented.
Never TODO({String? reason}) {
  throw UnimplementedError(
    reason ?? 'TODO: Implementation missing (an empty todo() has been called)',
  );
}

// Mandatory reason
/// This function can be placed on a variable or parameter whose value is yet to be implemented.
Never TODO(String reason) {
  throw UnimplementedError(
    reason,
  );
}

I don't have a strong opinion on whether the reason should be optional or mandatory, but I would prefer the mandatory variant.

Usage

if (snapshot.hasError) {
  return Center(
    child: TODO("Display the error")
  );
}
var data = getData(
  "[type]",
  TODO("get the data range that has to be collected"),
  [
    Filter([..]),
    Filter([..]),
  ]
);

I hope this can be implemented!

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-coretype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions