google / json_serializable.dart

Generates utilities to aid in serializing to/from JSON.
https://pub.dev/packages/json_serializable
BSD 3-Clause "New" or "Revised" License
1.55k stars 397 forks source link

fix: update pub_semver and build_runner version #1335

Closed ipcjs closed 1 year ago

ipcjs commented 1 year ago

Older versions of build_runner and pub_semver report the following error when executing dart run build_runner. So need to update them.

Building package executable... (4.1s)
Failed to build build_runner:build_runner:
/Users/ipcjs/.pub-cache/hosted/pub.dev/build_runner-2.3.2/lib/src/build_script_generate/bootstrap.dart:76:40: Error: Method not found: 'NullThrownError'.
      final error = e[0] as Object? ?? NullThrownError();
                                       ^^^^^^^^^^^^^^^
/Users/ipcjs/.pub-cache/hosted/pub.dev/pub_semver-2.1.1/lib/src/version_constraint.dart:96:13: Error: Method not found: 'FallThroughError'.
      throw FallThroughError();
            ^^^^^^^^^^^^^^^^
kevmoo commented 1 year ago

I get the idea here. Generally we DON'T do updates that just update lower bounds. Folks would have to upgrade to the latest version of this package to get these constraint bumps! (Does that make sense?)

ipcjs commented 1 year ago

Updating lower bounds can help developer deal with the problem of incorrect dependency versions.

It actually took me an hour to find out that the reason my code was not generating was because the version of pub_semver and build_runner was too low.🤔️

CicadaCinema commented 1 year ago

In case you are interested, there is an ongoing effort at BMW that can help to address this class of bugs: https://github.com/bmw-tech/dart_apitool

Incorrect lower bound constraints were also what I worked on as part of GSOC last summer and you can read about my findings here: https://arseny.uk/posts/gsoc2022/