Skip to content

[web]: Not working in Flutter web release mode #24

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

Closed
Ahmadre opened this issue Oct 4, 2019 · 2 comments
Closed

[web]: Not working in Flutter web release mode #24

Ahmadre opened this issue Oct 4, 2019 · 2 comments

Comments

@Ahmadre
Copy link

Ahmadre commented Oct 4, 2019

Probelm

Bildschirmfoto 2019-10-04 um 23 01 30

Getting above Error, when running getIt in flutter release mode on my server.

Versions

Flutter: v1.10.12-pre.6
GetIt: ^3.0.1

Flutter Doctor

[✓] Flutter (Channel master, v1.10.12-pre.6, on Mac OS X 10.14.6 18G95, locale de-DE)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.3)
[✓] VS Code (version 1.38.1)
[✓] Connected device (3 available)

• No issues found!

Code

import 'package:get_it/get_it.dart';
import 'dart:js' as js;

GetIt injector;

void main() {
  GetIt.allowMultipleInstances = true;
  injector = new GetIt.asNewInstance();
  injector.registerLazySingleton<UsersAPI>(() => new UsersAPI());
  injector.registerLazySingleton<PushAPI>(() => new PushAPI());
  runApp(MyApp());
}
...
@Ahmadre
Copy link
Author

Ahmadre commented Oct 4, 2019

ok, solved it by:

    GetIt injector = GetIt.instance;

I cloudn't see the instance, when I added the new ^^. And GetIt.allowMultipleInstances = true;wasn't needed also.

@Ahmadre Ahmadre closed this as completed Oct 4, 2019
@escamoteur
Copy link
Collaborator

Cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants