clear method

  1. @override
void clear()
override

If this is a caching asset bundle, clear all cached data.

Implementation

@override
// This is an override on Flutter 2.8 and later
// ignore: override_on_non_overriding_member
void clear() {
  try {
    (_bundle as dynamic).clear();
  } on NoSuchMethodError catch (_) {
    // The clear method exists as of Flutter 2.8
    // Previous versions don't have it, but later versions do.
    // We can't use `extends` in order to provide this method because this is
    // a wrapper and thus the method call must be forwarded.
    // On Flutter version before 2.8 we can't forward this call and
    // just catch the error which is thrown. On later version the call gets
    // correctly forwarded.
  }
}