localizely/intl_utils

Failed to build intl_utils:generate

Closed this issue · 3 comments

Hi Team,

I just updated my flutter project to the latest available releases of all dependencies and when I run "fvm flutter pub run intl_utils:generate" I now get the following set of errors ...


../../../.pub-cache/hosted/pub.dartlang.org/intl_utils-2.7.0/lib/src/intl_translation/extract_messages.dart:275:22: Error: The getter 'name' isn't defined for the class 'Token'.

  • 'Token' is from 'package:_fe_analyzer_shared/src/scanner/token.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-50.0.0/lib/src/scanner/token.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'name'.
    name = node.name.name;
    ^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/intl_utils-2.7.0/lib/src/intl_translation/extract_messages.dart:288:22: Error: The getter 'name' isn't defined for the class 'Token'.
  • 'Token' is from 'package:_fe_analyzer_shared/src/scanner/token.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-50.0.0/lib/src/scanner/token.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'name'.
    name = node.name.name;
    ^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/intl_utils-2.7.0/lib/src/intl_translation/extract_messages.dart:305:47: Error: The getter 'name' isn't defined for the class 'Token'.
  • 'Token' is from 'package:_fe_analyzer_shared/src/scanner/token.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-50.0.0/lib/src/scanner/token.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'name'.
    name = node.fields.variables.first.name.name;
    ^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/intl_utils-2.7.0/lib/src/intl_translation/extract_messages.dart:324:50: Error: The getter 'name' isn't defined for the class 'Token'.
  • 'Token' is from 'package:_fe_analyzer_shared/src/scanner/token.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-50.0.0/lib/src/scanner/token.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'name'.
    name = node.variables.variables.first.name.name;
    ^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/intl_utils-2.7.0/lib/src/intl_translation/extract_messages.dart:438:24: Error: The getter 'identifier' isn't defined for the class 'FormalParameter'.
  • 'FormalParameter' is from 'package:analyzer/dart/ast/ast.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/analyzer-5.2.0/lib/dart/ast/ast.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'identifier'.
    ?.map((x) => x.identifier?.name)
    ^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/intl_utils-2.7.0/lib/src/intl_translation/src/intl_message.dart:183:49: Error: The getter 'identifier' isn't defined for the class 'FormalParameter'.
  • 'FormalParameter' is from 'package:analyzer/dart/ast/ast.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/analyzer-5.2.0/lib/dart/ast/ast.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'identifier'.
    var parameterNames = outerArgs.map((x) => x.identifier?.name).toList();
    ^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/intl_utils-2.7.0/lib/src/intl_translation/src/intl_message.dart:190:26: Error: The argument type 'List' can't be assigned to the parameter type 'List<String?>'.
  • 'List' is from 'dart:core'.
    if (!checkArgs(args, parameterNames)) {
    ^
    ../../../.pub-cache/hosted/pub.dartlang.org/intl_utils-2.7.0/lib/src/intl_translation/src/intl_message.dart:294:5: Error: 'ClassOrMixinDeclaration' isn't a type.
    ClassOrMixinDeclaration? classNode(n) {
    ^^^^^^^^^^^^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/intl_utils-2.7.0/lib/src/intl_translation/src/intl_message.dart:296:16: Error: 'ClassOrMixinDeclaration' isn't a type.
    if (n is ClassOrMixinDeclaration) return n;
    ^^^^^^^^^^^^^^^^^^^^^^^
    pub finished with exit code 1

And below is the content of my pubspec.yaml file :


environment:
sdk: ">=2.12.0 <3.0.0"
flutter: ">=2.0.0"

publish_to: none

dependencies:
flutter:
sdk: flutter

get_it: ^7.2.0
provider: ^6.0.4

build_runner: ^2.3.2
built_value: ^8.4.2
built_collection: ^5.1.1
collection: ^1.17.0
diacritic: ^0.1.3
equatable: ^2.0.5
tuple: ^2.0.1
quiver: ^3.1.0
crypto: ^3.0.2
hex: ^0.2.0 # No update

json_annotation: ^4.7.0
json_serializable: ^6.5.4
shared_preferences: ^2.0.15
sqflite: ^2.2.0+3
path_provider: ^2.0.11
ext_storage:
git:
url: https://github.com/GitJournal/ext_storage.git
flutter_secure_storage: ^6.0.0
age_calculator: ^1.0.0
archive: ^3.3.4
flutter_email_sender: ^5.1.0

carousel_slider: ^4.1.1
dotted_border: ^2.0.0+3
flutter_cupertino_datetime_picker: ^3.0.0
smooth_page_indicator: ^1.0.0+2
oktoast: ^3.3.1
auto_size_text: ^3.0.0-nullsafety.0
percent_indicator: ^4.2.2
flutter_slidable: ^2.0.0
table_calendar: ^3.0.8
charts_flutter:
git:
url: https://github.com/google/charts.git
path: charts_flutter
simple_gradient_text: 1.2.4
flip_card: 0.6.0
fab_circular_menu: ^1.0.2
circular_menu: ^2.0.1

image_picker: 0.8.6
image_cropper: ^3.0.1
cupertino_icons: ^1.0.5
flutter_svg: ^1.1.6
font_awesome_flutter: ^10.2.1
screenshot: ^1.2.3
image_gallery_saver: ^1.7.1
animate_icons: ^2.0.0

http: ^0.13.5
cached_network_image: ^3.2.2
connectivity: ^3.0.6
url_launcher: ^6.1.6

firebase_core: ^2.2.0
firebase_auth: ^4.1.2
firebase_crashlytics: ^3.0.5
firebase_analytics: ^10.0.5
firebase_storage: ^11.0.5
cloud_firestore: ^4.0.5
firebase_messaging: ^14.1.0
flutter_local_notifications: ^12.0.3

permission_handler: ^10.2.0
share: ^2.0.4
package_info: ^2.0.2
file_picker: ^5.2.2

flutter_bluetooth_serial: ^0.4.0
flutter_reactive_ble: ^5.0.2

location: ^4.4.0

logger: ^1.1.0
device_info_plus: ^8.0.0

flutter_localizations:
sdk: flutter
intl: ^0.17.0
intl_utils: ^2.7.0

environment_config: ^3.1.0
after_layout: ^1.2.0
dartdoc: ^6.1.3

dev_dependencies:
flutter_test:
sdk: flutter

built_value_generator: ^8.4.2
r_flutter: ^0.9.0

dependency_overrides:
meta: ^1.8.0
analyzer: ^5.2.0
platform: ^3.1.0

flutter:
uses-material-design: true

assets:
- assets/
- assets/img/
- assets/fonts/
- assets/gif/

fonts:
- family: Black
fonts:
- asset: assets/fonts/Inter-Black.otf
- family: Bold
fonts:
- asset: assets/fonts/Inter-Bold.otf
- family: Extra
fonts:
- asset: assets/fonts/Inter-ExtraBold.ttf
- family: Medium
fonts:
- asset: assets/fonts/Inter-Medium.otf
- family: Regular
fonts:
- asset: assets/fonts/Inter-Regular.otf
- family: SemiBold
fonts:
- asset: assets/fonts/Inter-SemiBold.ttf
- family: Bebas
fonts:
- asset: assets/fonts/BebasKai.otf

r_flutter:
asset_classes:
".svg":
import: views/widget/svg_file.dart
class: SvgFile

flutter_intl:
enabled: true
arb_dir: assets/i10n


I couldn't find a way to get it works.

So, thanks for your help ...

I already tried to clean or repair the cache pub, I still have the same issues ...

Hope you'll find the reason why !

Hi @sebcoda,

According to the attached info, I would say that the problem is probably with the overridden version of the analyzer.
Could you check if usage of the intl_utils ^2.8.0 solves this issue?

@lzoran ... Many thanks for the answer ... Now it's working well !