isFutureVoid abstract method
Determines whether this method declares a Future<void> return type.
This method inspects the declared return type of the method and returns
true if it represents an asynchronous computation that completes with
no value (i.e., a Future<void>).
It is particularly useful in reflection, proxy generation, or method interceptors where you need to distinguish between:
- Asynchronous void methods (
Future<void>) that perform side effects, - Asynchronous value-returning methods (
Future<T>), and - Synchronous void methods (
void).
Example
class Example {
Future<void> save() async {}
Future<int> compute() async => 42;
void reset() {}
}
final saveMethod = Class(Example).getMethod('save');
final computeMethod = Class(Example).getMethod('compute');
final resetMethod = Class(Example).getMethod('reset');
print(saveMethod.isFutureVoid()); // true
print(computeMethod.isFutureVoid()); // false
print(resetMethod.isFutureVoid()); // false
@return true if the method’s return type is Future<void>,
false otherwise.
Implementation
bool isFutureVoid();