slang-i18n / slang

Type-safe i18n for Dart and Flutter
https://pub.dev/packages/slang
MIT License
459 stars 39 forks source link

Class 'Translations' can't define static member 'of' and have instance member 'Translations.of' with the same name (version 3.26.0 and above) #233

Closed WieFel closed 1 month ago

WieFel commented 2 months ago

Describe the bug From version 3.26.0 or above of slang and slang_flutter, I get the following error in the file strings.g.dart:

Class 'Translations' can't define static member 'of' and have instance member 'Translations.of' with the same name.  Try renaming the member to a name that doesn't conflict.

Not sure if this has anything to do with my configuration. But if I use version 3.25.0 or below, I don't get any error.

To Reproduce Steps to reproduce the behavior:

  1. Use version 3.26.0 or above of slang and slang_flutter
  2. Run dart run slang
  3. See the error in strings.g.dart

Expected behavior No errors in strings.g.dart after generating the file.

Additional context

flutter doctor ``` Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-arm64, locale en-IT) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.4) [✓] Chrome - develop for the web [✓] Android Studio (version 2024.1) [✓] VS Code (version 1.90.2) [✓] Connected device (4 available) [✓] Network resources • No issues found! ```
Tienisto commented 1 month ago

Yeah, of is now reserved because it is used as a function. So please rename it to another key like of_, ofStr.