dart - How to clear app cache programmatically on Flutter - Stack Overflow

PHOTO EMBED

Sat Oct 02 2021 12:02:39 GMT+0000 (Coordinated Universal Time)

Saved by @awaisab171 #dart

import 'package:path_provider/path_provider.dart';
Future<void> _deleteCacheDir() async {
final cacheDir = await getTemporaryDirectory();
if (cacheDir.existsSync()) {
cacheDir.deleteSync(recursive: true);}}
final appDir = await getApplicationSupportDirectory();
if (appDir.existsSync()) {
appDir.deleteSync(recursive: true);}}
content_copyCOPY

https://stackoverflow.com/questions/53296899/how-to-clear-app-cache-programmatically-on-flutter