ClearCached class

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();
Annotations
  • @Target({TargetKind.method})

Constructors

ClearCached([String? methodName])
ClearCache
const

Properties

hashCode int
The hash code for this object.
no setterinherited
methodName String?
Name of method to be cache clear
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited