I updated plugin version from 1.4.2 to 3.1.2 and released on Google Play Store.
(At the same time, I updated the flutter version from 1.22.6 to 2.2.3.)
And then, there was some reports of the bug that the image doesn't show up, and it stays on the loading screen all the time.
But I can't reproduce the bug on my phone.
I think that bug is caused by the cache database not being updated for some reason when the app is updated.
Here is the error that Firebase Crashlytics catched.
Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: DatabaseException(no such column: key (code 1 SQLITE_ERROR[1]): , while compiling: SELECT * FROM cacheObject WHERE key = ?) sql 'SELECT * FROM cacheObject WHERE key = ?' args [https://firebasestorage.googleapis.com/v0/bappspot.com/o/channel-images%2FdluP5hY0o3FZmXYt1mjN%2Fsmall2.jpg?alt=media]}. Error thrown Instance of 'ErrorDescription'.
at .wrapDatabaseException(exception_impl.dart:11)
at SqfliteDatabaseMixin.txnRawQuery.<fn>(database_mixin.dart:406)
at BasicLock.synchronized(basic_lock.dart:33)
at SqfliteDatabaseMixin.txnSynchronized(database_mixin.dart:346)
at CacheObjectProvider.get(cache_object_provider.dart:110)
at CacheStore._getCacheDataFromDatabase(cache_store.dart:111)
Then, as an emergency measure, I deleted the cache DB and the cached images when the app started.
Here is the code.
```dart
Future deleteCache() async {
await _deleteCacheDatabase();
await _deleteImageDirectory();
}
Future _deleteCacheDatabase() async {
try {
final databaseDirectoryPath = await getApplicationSupportDirectory();
final databaseFilePath =
join(databaseDirectoryPath.path, '${DefaultCacheManager.key}.db');
final databaseFile = File(databaseFilePath);
final databaseExists = databaseFile.existsSync();
if (databaseExists) {
await deleteDatabase(databaseFilePath);
}
} on Exception catch (e) {
Crashlytics().recordError(exception: e);
}
}
Future _deleteImageDirectory() async {
try {
final cacheDirectoryPath = await getTemporaryDirectory();
final imageDirectoryPath =
join(cacheDirectoryPath.path, '${DefaultCacheManager.key}');
final imageDirectory = Directory(imageDirectoryPath);
final imageDirectoryExists = imageDirectory.existsSync();
if (imageDirectoryExists) {
imageDirectory.deleteSync(recursive: true);
}
} on Exception catch (e) {
Crashlytics().recordError(exception: e);
}
}
```
It was working fine on my device, but when I released it to Google Play Store, I got the following error and it seems that some devices are not displaying images properly.
DatabaseException(no such table: cacheObject (code 1 SQLITE_ERROR): , while compiling: SELECT * FROM cacheObject WHERE key = ?) sql 'SELECT * FROM cacheObject WHERE key = ?' args [https://firebasestorage.googleapis.com/v0/b/...]. Error thrown Instance of 'ErrorDescription'.
That's really weird. De database logic contains a migration to add the key column. The second exception looks like the table is deleted and not the database. At the moment I don't know how you can fix this, I'm sorry.
🐛 Bug Report
Expected behavior
Images display without problems.
Reproduction steps
I updated plugin version from 1.4.2 to 3.1.2 and released on Google Play Store. (At the same time, I updated the flutter version from 1.22.6 to 2.2.3.)
And then, there was some reports of the bug that the image doesn't show up, and it stays on the loading screen all the time. But I can't reproduce the bug on my phone. I think that bug is caused by the cache database not being updated for some reason when the app is updated.
Here is the error that Firebase Crashlytics catched.
Then, as an emergency measure, I deleted the cache DB and the cached images when the app started.
Here is the code.
```dart FutureIt was working fine on my device, but when I released it to Google Play Store, I got the following error and it seems that some devices are not displaying images properly.
Please let me know how I can fix the error.
Configuration
Version: 3.1.2
Platform: