ilteoood / flutter_i18n

I18n made easy, for Flutter!
MIT License
217 stars 57 forks source link

DevTools - Select Widget Mode #137

Closed SeFeX closed 3 years ago

SeFeX commented 3 years ago

When I activate widget selection mode in Dart DevTools it throws an exception of "Bad State: Stream has already been listened to."

The following StateError was thrown building Builder(dependencies: [_LocalizationsScope-[GlobalKey#97345]]): Bad state: Stream has already been listened to. The relevant error-causing widget was: MaterialApp lib\main.dart:37 When the exception was thrown, this was the stack:

image

image

image

I don't know if this goes here or in the Dart DevTools issues, the fact is that without the library flutter_i18n the select widget mode works fine

ilteoood commented 3 years ago

That's really strange. Are you using one of the stream introduced in 0.20.0?

SeFeX commented 3 years ago

No, I only use the translation function, this is an example, all app translations are the same with different key FlutterI18n.translate (context," onboarding.skip ")

ilteoood commented 3 years ago

Can you reproduce it with the example app provided? I'm trying with it but without any luck: image

SeFeX commented 3 years ago

Steps reproduced with Android Studio, I created a new flutter project, I imported the flutter_i18n library, the translation works correctly, but when activating Flutter Inspector, which has been the same Flutter DevTools, and clicking on the Select Widget Mode option, it causes a exception in the MaterialApp widget:

image

Showing how Select Widget Mode works without the library: image

I uploaded this project for you to test, but it will probably also fail with the repository example https://github.com/SeFeX/Flutter-Demo-i18n

ilteoood commented 3 years ago

Found it! Thank you so much, it'll be fixed with 0.20.1