-
Notifications
You must be signed in to change notification settings - Fork 254
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
UnregisteredInstance ERROR 🧨 (Flutter last version) #972
Comments
@jacobaraujo7 please help me! God bless you. |
@fabiototh, this correct is class CoreModule extends Module {
@override
void exportedBinds(Injector i) {
i.addSingleton(SearchStore.new, config: storeConfig());
}
} |
Hello, @eduardoflorence, I was using Flutter version 3.16.0, then I updated the (large) project to the latest version. Before the update, everything was working perfectly. This has happened to me before; it seems like flutter_modular “breaks” things. I fixed it by putting everything into the same CoreModule, and by everything, I mean all the modules that were imported into the AppModule. Only then did it work. It’s really discouraging. eu estava usando a versão do flutter 3.16.0 dai atualizei o projeto (grande) para a ultima. Antes estava tudo funcionando perfeitamente. Isso já me aconteceu uma vez, parece que o flutter_modular "estraga". Eu resolvi, colocando tudo no mesmo CoreModule, em tudo eu quero dizer: tudo que estava dentro de Module, que estava importado os módulos no AppModule. |
Mas pode fazer como eu falei acima que funciona certinho. Eu uso o Flutter e Modular em suas últimas versões e funciona tudo perfeito. |
O CoreModule estava exportBinds. E mesmo assim fala que UnregisteredInstance. Recentemente criei um projeto na ultima versão do Flutter tamanho médio, e realmente não tive problemas nenhum. Mas esse projeto especificamente, ao atualizar não funciona de jeito nenhum. |
@fabiototh resolveu? tenho o mesmo problema |
Describe the bug
Usei um FORK do modular, rodando em example.
To simulate this:
Mover i.addSingleton(SearchStore.new, config: storeConfig()); para um novo CoreModule:
Importar CoreModule no AppModule:
Ao executar, você recebe o seguinte erro:
The following UnregisteredInstance was thrown building _FocusInheritedScope:
SearchByText not registered.
SearchStore => SearchByText
Environment
Add your
flutter doctor -v
[✓] Flutter (Channel stable, 3.24.3, on macOS 15.0.1 24A348 darwin-arm64, locale
pt-BR)
• Flutter version 3.24.3 on channel stable at /Users/fabiocarlos/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2663184aa7 (6 weeks ago), 2024-09-11 16:27:48 -0500
• Engine revision 36335019a8
• Dart version 3.5.3
• DevTools version 2.37.3
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/fabiocarlos/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android
Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
17.0.10+0-17.0.10b1087.21-11609105)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16A242d
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
17.0.10+0-17.0.10b1087.21-11609105)
[✓] VS Code (version 1.94.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.98.0
[✓] Connected device (5 available)
• 23129RA5FL (mobile) • d1a7c5b4 •
android-arm64 • Android 14 (API 34)
• iPhone de Fábio Carlos de Souza (mobile) • 00008030-0016481914C1802E • ios
• iOS 18.0.1 22A3370
• macOS (desktop) • macos •
darwin-arm64 • macOS 15.0.1 24A348 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad •
darwin • macOS 15.0.1 24A348 darwin-arm64
• Chrome (web) • chrome •
web-javascript • Google Chrome 129.0.6668.101
[✓] Network resources
• All expected network resources are available.
• No issues found!
Add your
pubspec.yaml
Add your
Info.plist
same of the modular example
Add your
AppDelegate.swift
same of the modular example
Add your
MainActivity
same of the modular example
Add your
AndroidManifest.xml
same of the modular example
Add your
/app/res/values/strings.xml
same of the modular example
To Reproduce
Read Describe the bug
Expected behavior
Modular working with CoreModule
The text was updated successfully, but these errors were encountered: