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

Error: The getter 'a', 'r', 'g' and 'b' isn't defined for the class 'Color' - with new version 5.3.0 and Flutter 3.24.5 #1234

Open
marcellocamara opened this issue Jan 22, 2025 · 6 comments
Assignees
Labels

Comments

@marcellocamara
Copy link

The new version of google_mobile_ads: 5.3.0, didn't run with flutter 3.24.5, and dart 3.5.4, it requires flutter version >= 3.27.
To solve it, just need to bump the flutter version - but there are people who can't do the version bump - in this case should'n the documentation be fixed with the new minimum dart version?

As documentation says, it should be able to run at minimum dart 2.17 (but it's not):
Image

See the error logs when try to build:

Error log ../../.pub-cache/hosted/pub.dev/google_mobile_ads-5.3.0/lib/src/ad_instance_manager.dart:992:33: Error: The getter 'a' isn't defined for the class 'Color'. - 'Color' is from 'dart:ui'. Try correcting the name to the name of an existing getter, or defining a getter or field named 'a'. writeValue(buffer, (value.a * 255).toInt()); ^

../../.pub-cache/hosted/pub.dev/google_mobile_ads-5.3.0/lib/src/ad_instance_manager.dart:993:33: Error: The getter 'r' isn't defined for the class 'Color'.

  • 'Color' is from 'dart:ui'.
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'r'.
    writeValue(buffer, (value.r * 255).toInt());
    ^

../../.pub-cache/hosted/pub.dev/google_mobile_ads-5.3.0/lib/src/ad_instance_manager.dart:994:33: Error: The getter 'g' isn't defined for the class 'Color'.

  • 'Color' is from 'dart:ui'.
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'g'.
    writeValue(buffer, (value.g * 255).toInt());
    ^

../../.pub-cache/hosted/pub.dev/google_mobile_ads-5.3.0/lib/src/ad_instance_manager.dart:995:33: Error: The getter 'b' isn't defined for the class 'Color'.

  • 'Color' is from 'dart:ui'.
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'b'.
    writeValue(buffer, (value.b * 255).toInt());
    ^

Target kernel_snapshot_program failed: Exception

Plugin Version

google_mobile_ads: ^5.3.0

The problem

Steps to Reproduce

Update this package to 5.3.0 and run with Flutter 3.24.5.

@marcellocamara
Copy link
Author

The Color class, on Flutter 3.24.5 with Dart 3.5.4, is defined with this fields:

  int get alpha => (0xff000000 & value) >> 24;
  ...
  int get red => (0x00ff0000 & value) >> 16;
  ...
  int get green => (0x0000ff00 & value) >> 8;
  ...
  int get blue => (0x000000ff & value) >> 0;

There are no a, r, g and b variables.

@ItsJoltix
Copy link

I'm also experiencing this issue... Is there any fix for this without having to upgrade?

@marcellocamara
Copy link
Author

@ItsJoltix
Is there any fix for this without having to upgrade?

You can remove the ^ from your pubspec.yaml dependencies, to avoid any update

google_mobile_ads: 5.2.0 fixes the version
google_mobile_ads: ^5.2.0 updates the version to 5.3.0 and causes the crash.

@malandr2
Copy link
Collaborator

Thanks all, I see a change was made in https://github.com/googleads/googleads-mobile-flutter/pull/1223/files. I've escalated this to @LTPhantom to take a closer look

@deep-esh7
Copy link

yes when integrating app getting crashed only . what to do ?

@LTPhantom
Copy link
Collaborator

Hello everyone! Will work on a fix and make a patch release as soon as possible

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

No branches or pull requests

5 participants