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

chore: explicit Uint8List cast in at_lookup_impl.dart #532

Merged
merged 2 commits into from
Mar 20, 2024
Merged

Conversation

JeremyTubongbanua
Copy link
Member

@JeremyTubongbanua JeremyTubongbanua commented Mar 20, 2024

- What I did

  • Add explicit as Uint8List cast

- How I did it

- How to verify it

- Description for the changelog

  • discussed in architecture call that explicit cast wouldn't do any harm
  • This is an issue that only I am running into

- Context

../../.pub-cache/hosted/pub.dev/at_lookup-3.0.46/lib/src/at_lookup_impl.dart:181:16: Error: The argument type 'List<int>' can't be assigned to the parameter type 'Uint8List'.
 - 'List' is from 'dart:core'.
 - 'Uint8List' is from 'dart:typed_data'.
          utf8.encode(value), base64Decode(dataSignature));

I would get this error once I dart pub cache clean && dart pub get.

But by making the change in this PR, it would be fixed.

- Additional context

My pubspec.yaml:

name: dart_playground
description: A sample command-line application.
version: 1.0.0
# repository: https://github.com/my_org/my_repo

environment:
  sdk: ^3.1.3

# Add regular dependencies here.
dependencies:
  args: ^2.4.2
  at_client: ^3.0.75
  at_onboarding_cli: ^1.4.3
  at_utils: ^3.0.16
  version: ^3.0.2
  # path: ^1.8.0

dev_dependencies:
  lints: ^2.0.0
  test: ^1.21.0

@JeremyTubongbanua JeremyTubongbanua self-assigned this Mar 20, 2024
@XavierChanth XavierChanth requested a review from gkc March 20, 2024 15:46
Copy link
Contributor

@gkc gkc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add the hint for the linter to ignore unnecessary cast

@JeremyTubongbanua
Copy link
Member Author

dart-lang/sdk#52801

From @XavierChanth :

Dart 3.2 had a breaking change in it, which is why you are experiencing the issue that you are.

So the options are either:

  • Add the cast back into at_lookup and all other places (and subsequently mark places to ignore unnecessary explicit casts because people running sdk >= 3.2.0 will get this lint warning)
  • Set the minimum sdk version to 3.2.0 across our packages (3.2.0 came out in November, so it is very recent, definitely a good chunk of people who haven't updated yet)

@gkc
Copy link
Contributor

gkc commented Mar 20, 2024

Option 1 has my vote 100%

@XavierChanth
Copy link
Member

I think this is the syntax for it then:

      // ignore: unnecessary_cast

@gkc
Copy link
Contributor

gkc commented Mar 20, 2024

Yes - if you search for "unnecessary cast" in at_libraries you'll see where we've done this before

@JeremyTubongbanua JeremyTubongbanua requested a review from gkc March 20, 2024 16:18
@gkc gkc merged commit a6723c1 into trunk Mar 20, 2024
11 checks passed
@gkc gkc deleted the jeremy-trunk branch March 20, 2024 16:45
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.

3 participants