yuzurihaaa / clean_architecture_sample

Flutter application on Clean Architecture approach.
2 stars 0 forks source link

Upgrade dart to use nnbd. #4

Closed yuzurihaaa closed 1 month ago

yuzurihaaa commented 3 years ago

Time to give dart 2.10 a try.

TomerPacific commented 3 years ago

@zaralockheart , I'd like to help. Is all that is needed to do in this issue is to upgrade the dart version?

yuzurihaaa commented 3 years ago

Hi @TomerPacific , thanks for willing to help! I created issue for me to track down what I plan for this repo (also to help out fellow hacktoberfest) yeah, upgrade, and maybe to also refactor the codes into nnbd style. I haven’t give that a try yet, so I am assuming it will take more than the change in pubspecs.yaml πŸ™‚

TomerPacific commented 3 years ago

@zaralockheart , got it. I'm not familiar with NNBD, but I'll keep you updated on what I am trying to do.

TomerPacific commented 3 years ago

@zaralockheart, from reading online a bit, I found this SO question which pointed to this NNBD migration tool. Might be worth looking into.

Would you like me to try and use this migration tool?

TomerPacific commented 3 years ago

Also, I am getting this error when trying to perform pub get:

Because hive_generator >=0.8.0 depends on analyzer >=0.40.0 <2.0.0 and mockito 4.1.2 depends on analyzer ^0.39.15, hive_generator >=0.8.0 is incompatible with mockito 4.1.2. And because no versions of mockito match >4.1.2 <5.0.0, hive_generator >=0.8.0 is incompatible with mockito ^4.1.2. So, because data depends on both mockito ^4.1.2 and hive_generator ^0.8.1, version solving failed.

yuzurihaaa commented 3 years ago

@TomerPacific Hi, yeah sure, you can use the tool to ease out the migration, there's no hard requirement here :) I think those are due to data domain/ pubspec.yaml files. Maybe override_dependency could help there.

TomerPacific commented 3 years ago

@zaralockheart , got it working by adding : dependency_overrides: hive_generator: ^0.8.0 mockito: ^4.1.1

When trying to run the dart migrate command, there are many dependencies which need to be updated or are either incompatible.

dart migrate
Warning: dependencies are outdated. The version(s) of one or more packages currently checked out have not yet migrated to the Null Safety feature.

    _fe_analyzer_shared, currently at version 11.0.0
    analyzer, currently at version 0.40.4
    ansicolor, currently at version 1.0.2
    args, currently at version 1.6.0
    async, currently at version 2.5.0-nullsafety.1
    bloc, currently at version 6.0.2
    boolean_selector, currently at version 2.1.0-nullsafety.1
    build, currently at version 1.5.0
    build_config, currently at version 0.4.2
    build_daemon, currently at version 2.1.4
    build_resolvers, currently at version 1.4.1
    build_runner, currently at version 1.10.3
    build_runner_core, currently at version 6.0.3
    built_collection, currently at version 4.3.2
    built_value, currently at version 7.1.0
    characters, currently at version 1.1.0-nullsafety.3
    charcode, currently at version 1.2.0-nullsafety.1
    checked_yaml, currently at version 1.0.2
    cli_util, currently at version 0.2.0
    clock, currently at version 1.1.0-nullsafety.1
    code_builder, currently at version 3.4.1
    collection, currently at version 1.15.0-nullsafety.3
    connectivity, currently at version 0.4.9+3
    connectivity_for_web, currently at version 0.3.1
    connectivity_macos, currently at version 0.1.0+3
    connectivity_platform_interface, currently at version 1.0.6
    console_log_handler, currently at version 1.1.6
    convert, currently at version 2.1.1
    crypto, currently at version 2.1.4
    cupertino_icons, currently at version 1.0.0
    dart_style, currently at version 1.3.7
    data, currently at version 1.0.0
    domain, currently at version 1.0.0
    equatable, currently at version 1.2.5
    fake_async, currently at version 1.2.0-nullsafety.1
    fixnum, currently at version 0.10.11
    flutter, currently at version 0.0.0
    flutter_bloc, currently at version 6.0.6
    flutter_hooks, currently at version 0.14.1
    flutter_localizations, currently at version 0.0.0
    flutter_plugin_android_lifecycle, currently at version 1.0.8
    flutter_test, currently at version 0.0.0
    flutter_web_plugins, currently at version 0.0.0
    get_it, currently at version 5.0.1
    glob, currently at version 1.2.0
    google_maps_flutter, currently at version 1.0.2
    google_maps_flutter_platform_interface, currently at version 1.0.4
    graphs, currently at version 0.2.0
    hive, currently at version 1.4.4+1
    hive_flutter, currently at version 0.3.1
    http_multi_server, currently at version 2.2.0
    http_parser, currently at version 3.1.4
    intl, currently at version 0.16.1
    io, currently at version 0.3.4
    js, currently at version 0.6.1+1
    json_annotation, currently at version 3.0.1
    latlong, currently at version 0.6.1
    location, currently at version 3.0.2
    location_platform_interface, currently at version 1.0.0
    location_web, currently at version 1.0.0
    logging, currently at version 0.11.4
    matcher, currently at version 0.12.10-nullsafety.1
    meta, currently at version 1.3.0-nullsafety.3
    mime, currently at version 0.9.6+3
    mockito, currently at version 4.1.2
    nested, currently at version 0.0.4
    node_interop, currently at version 1.1.1
    node_io, currently at version 1.1.1
    package_config, currently at version 1.9.3
    path, currently at version 1.8.0-nullsafety.1
    path_provider, currently at version 1.6.9
    path_provider_macos, currently at version 0.0.4+3
    path_provider_platform_interface, currently at version 1.0.2
    pedantic, currently at version 1.9.0
    platform, currently at version 2.2.1
    plugin_platform_interface, currently at version 1.0.2
    pool, currently at version 1.4.0
    provider, currently at version 4.3.2+1
    pub_semver, currently at version 1.4.4
    pubspec_parse, currently at version 0.1.5
    quiver, currently at version 2.1.3
    shelf, currently at version 0.7.5
    shelf_web_socket, currently at version 0.2.3
    sky_engine, currently at version 0.0.99
    source_gen, currently at version 0.9.7+1
    source_span, currently at version 1.8.0-nullsafety.2
    stack_trace, currently at version 1.10.0-nullsafety.1
    stream_channel, currently at version 2.1.0-nullsafety.1
    stream_transform, currently at version 1.2.0
    string_scanner, currently at version 1.1.0-nullsafety.1
    term_glyph, currently at version 1.2.0-nullsafety.1
    test_api, currently at version 0.2.19-nullsafety.2
    timing, currently at version 0.1.1+2
    typed_data, currently at version 1.3.0-nullsafety.3
    validate, currently at version 1.7.0
    vector_math, currently at version 2.1.0-nullsafety.3
    watcher, currently at version 0.9.7+15
    web_socket_channel, currently at version 1.1.0
    yaml, currently at version 2.2.1

It is highly recommended to upgrade all dependencies to versions which have migrated. Use `dart pub outdated --mode=null-safety` to check the status of dependencies.

When trying to perform pub upgrade without the dependency_overrides, it fails. If I add the dependency_overrides, it doesn't manage to successfully update all dependencies.

yuzurihaaa commented 3 years ago

Sry, was quiet busy recently. Aww, this doesn't looks fun :(

I haven't look into NNBD yet, but maybe I can look into it deeper when I have the time. Is this related to this warning https://github.com/dart-lang/sdk/issues/41712 ?

TomerPacific commented 3 years ago

@zaralockheart , I don't think so. I think it has to do with the different packages you have in this project, their inner dependencies and the fact that some of them don't have a version that supports NNBD. What would you like me to do with this issue?

yuzurihaaa commented 3 years ago

I guess, I'll take stuff that you've done, and will keep this open for future exploration. πŸ™πŸ» Thanks for the help! I didn't expect anyone would come to this repo actually πŸ˜…

TomerPacific commented 3 years ago

Always glad to help. Do you want me to open a PR for anything? I basically changed the version in pubspec.yaml and upgraded various packages.

yuzurihaaa commented 3 years ago

Any PRs are welcomed :)

TomerPacific commented 3 years ago

@zaralockheart , I have opened a PR. I would appreciate it if you would add the hacktoberfest-accepted label to it.

yuzurihaaa commented 3 years ago

Thanks @TomerPacific for the help :)

yuzurihaaa commented 3 years ago

Reopen for self track, maybe the feature will me much for stable for the other packages to migrate to use it.