Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating to null safety AND android embedding v2 #81

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shinayser
Copy link

Migrating the app to null safety (flutter 2.0).
Also done the migration of the sample app to Android Embedding v2.

@Tiska
Copy link

Tiska commented Mar 14, 2021

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

@shinayser
Copy link
Author

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!

@qbait
Copy link

qbait commented Mar 18, 2021

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

@ghenry
Copy link

ghenry commented Mar 20, 2021

Is this good for Flutter 2 as well which also incorporates #82 change of MD5 ?

@andreystavitsky
Copy link

andreystavitsky commented Mar 22, 2021

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);

@andreystavitsky
Copy link

dio: ^4.0.0-prev1

this PR compatible only with dio: 4.0.0-beta4

@erickok
Copy link
Contributor

erickok commented Mar 23, 2021

👋 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?

@SmarterVision
Copy link

SmarterVision commented Mar 23, 2021

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');
                            ^

@shinayser
Copy link
Author

shinayser commented Mar 23, 2021

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
#84 has done a work better than mine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants