ClearCached constructor

const ClearCached([
  1. String? methodName
])

ClearCache

Annotation for Cached package.

Throws an InvalidGenerationSourceError

  • if method with @cached annotation doesn’t exist
  • if method to pair doesn’t exist
  • if method don't return bool, Future

Example

We have a method with @Cached() annotation

@Cached()
Future<SomeResponseType> getSthData() {
  return  dataSource.getData();
}

to clear cache this method, we just add clear phrase before name method

@clearCached
void clearGetSthData();

or we can use annotation with argument, then the method name doesn't matter, we just need to add the name of the method we want to clean to the argument

@ClearCached("getSthData")
void clearMe();

Implementation

const ClearCached([this.methodName]);