This commit is contained in:
austinried
2023-04-28 09:24:51 +09:00
parent 35b037f66c
commit f0f812e66a
402 changed files with 34368 additions and 62769 deletions

30
lib/cache/image_cache.dart vendored Normal file
View File

@@ -0,0 +1,30 @@
// ignore_for_file: implementation_imports
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter_cache_manager/src/storage/file_system/file_system_io.dart';
import 'package:http/http.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import '../http/client.dart';
part 'image_cache.g.dart';
CacheManager _openImageCache(BaseClient httpClient) {
const key = 'images';
return CacheManager(
Config(
key,
stalePeriod: const Duration(days: 2147483647),
maxNrOfCacheObjects: 2147483647,
repo: JsonCacheInfoRepository(databaseName: key),
fileSystem: IOFileSystem(key),
fileService: HttpFileService(httpClient: httpClient),
),
);
}
@Riverpod(keepAlive: true)
CacheManager imageCache(ImageCacheRef ref) {
final http = ref.watch(httpClientProvider);
return _openImageCache(http);
}

23
lib/cache/image_cache.g.dart vendored Normal file
View File

@@ -0,0 +1,23 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'image_cache.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
String _$imageCacheHash() => r'aaeb74898734c2776f594e05eb82262af20e079f';
/// See also [imageCache].
@ProviderFor(imageCache)
final imageCacheProvider = Provider<CacheManager>.internal(
imageCache,
name: r'imageCacheProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product') ? null : _$imageCacheHash,
dependencies: null,
allTransitiveDependencies: null,
);
typedef ImageCacheRef = ProviderRef<CacheManager>;
// ignore_for_file: unnecessary_raw_strings, subtype_of_sealed_class, invalid_use_of_internal_member, do_not_use_environment, prefer_const_constructors, public_member_api_docs, avoid_private_typedef_functions