dio-http-cache
dio-http-cache copied to clipboard
Migrating to null safety AND android embedding v2
Migrating the app to null safety (flutter 2.0). Also done the migration of the sample app to Android Embedding v2.
Hi, in store_meromy.dart, you init an empty list : if (null == subKeyList) subKeyList = List.empty();
Empty list are not growable by default, the next line a add is made on that list, so the code crach
Hi, in store_meromy.dart, you init an empty list : if (null == subKeyList) subKeyList = List.empty();
Empty list are not growable by default, the next line a add is made on that list, so the code crach
Fixed!
Getting that error when trying to run the app with this PR's version of dio-http-cache
../../.pub-cache/git/dio-http-cache-b68b588030a403b17ffcaef011006e71d89fe84c/lib/src/manager_dio.dart:36:22: Error: The argument type 'dynamic Function(RequestOptions)' can't be assigned to the parameter type 'void Function(RequestOptions, RequestInterceptorHandler)?'.
- 'RequestOptions' is from 'package:dio/src/options.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dio-4.0.0-prev1/lib/src/options.dart').
- 'RequestInterceptorHandler' is from 'package:dio/src/interceptor.dart' ('../../.pub-cache/hosted/pub.dartlang.org/dio-4.0.0-prev1/lib/src/interceptor.dart').
onRequest: _onRequest, onResponse: _onResponse, onError: _onError);
My initialization:
dio.interceptors.add(DioCacheManager(CacheConfig(baseUrl: baseUrl)).interceptor);
My dependencies:
dio: ^4.0.0-prev1
dio_http_cache:
git:
url: [email protected]:shinayser/dio-http-cache.git
ref: master
retrofit: 2.0.0-beta1
json_annotation: ^4.0.0
json_serializable: ^4.0.3
build_runner: ^1.11.1
retrofit_generator: ^2.0.0-beta1
Is this good for Flutter 2 as well which also incorporates #82 change of MD5 ?
Migrating the app to null safety (flutter 2.0). Also done the migration of the sample app to Android Embedding v2.
lib/src/store/store_disk.dart:32:23: Warning: Operand of null-aware operation '!' has type 'String' which excludes null. await Directory(path!).create(recursive: true);
dio: ^4.0.0-prev1
this PR compatible only with dio: 4.0.0-beta4
👋 Thanks for the work but I am a bit confused how how you got this working. The library is indeed technically updated to nullsafety but doesn't even compile as the dio 4 interceptor method signature changed. Did you forget to commit come changes, maybe?
Hi, Would you please check the following errors
/C:/flutter/.pub-cache/git/dio-http-cache-b68b588030a403b17ffcaef011006e71d89fe84c/lib/src/store/store_disk.dart:32:23: Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
await Directory(path!).create(recursive: true);
^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_cache_manager-3.0.0-nullsafety.1/lib/src/storage/cache_info_repositories/cache_object_provider.dart:208:29: Warning: Operand of null-aware operation '!' has type 'String' which excludes null.
final oldDbPath = join((await getDatabasesPath())!, '$databaseName.db');
^
Guys I am on same boat as you... since the maintainer didn't provided a null safety version yet, I tried to do it myself. But seems that https://github.com/hurshi/dio-http-cache/pull/84 has done a work better than mine!