Open
Description
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!