slang-i18n / slang

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

TextSpan is not found after updating to 2.4.1 #82

Closed k0shk0sh closed 2 years ago

k0shk0sh commented 2 years ago

Describe the bug

packages/locale/lib/translations/strings.g.dart:254:9: Error: Couldn't find constructor 'TextSpan'.
        const TextSpan(text: ' sent you notification'),
              ^^^^^^^^

 - '_StringsNotificationsEn' is from 'package:locale/translations/strings.g.dart' ('packages/locale/lib/translations/strings.g.dart').
Try correcting the name to the name of an existing method, or defining a method named 'TextSpan'.
    InlineSpan unknown({required InlineSpan name}) => TextSpan(children: [ ....

To Reproduce Steps to reproduce the behavior:

  1. use below:

    "notifications": {
    "message(rich)": "$name sent you a message",
    "liked(rich)": "$name liked your post",
    "commented(rich)": "$name commented on your post",
    "follow(rich)": "$name is now following you",
    "unknown(rich)": "$name sent you notification"
    },
  2. call flutter pub run slang

Expected behavior No exception/error.

Temp-Fix: adding package:flutter/widgets.dart manually to file fixes the issue.

Tienisto commented 2 years ago

Hi, you only have slang_flutter: 2.4.1 right? You probably need to lock slang to 2.4.1 too.

k0shk0sh commented 2 years ago

@Tienisto I have both.

Tienisto commented 2 years ago

Unfortunately, I cannot reproduce this.

Can you print the output of flutter pub deps and of your build.yaml please?

k0shk0sh commented 2 years ago

the issue was with my setup. I had a module (locales) that was depending on main pubspec.lock but somehow that didn't work. had to reinit my melos and it work.

thanks.