Questions tagged [injectable]

121 questions
1
vote
2 answers

Bloc depends on unregistered type - Injectable

I'm using injectable lib according to a tutorial in youtube some of annotations replaced. but I visit injectable lib in pub.dev look to the changelog and replaced > RegisterAs(Type) by > Injectable(as:Type) but it not working and give unregistered…
1
vote
1 answer

How to get Injectable to generate dependency injection for third party Abstract class thats using factory constructors

I am trying to register the class below with the package Injectable. import 'dart:io'; import 'package:injectable/injectable.dart'; @injectable class IWantToBeRegistered { final File file; IWantToBeRegistered({ required this.file, …
1
vote
1 answer

Performance with injectable, get_it Flutter

I have a question. In my project, I have some class with singleton. DioMethod (some api configs), Repository (Connect ApiProvider and BLoc class), ApiProvider (call api => get data => pass to Repository), Some BloC classes such as MoviesBloc,…
Vu Thanh
  • 319
  • 1
  • 14
1
vote
1 answer

preferRelativeImports usage in injectable

I am learning injectable library, What does preferRelativeImports property do? @InjectableInit( initializerName: r'$initGetIt', // default preferRelativeImports: true, // --> this property asExtension: false, // default )
1
vote
1 answer

Should you inject an interface or its implementation?

Should I inject an interface or its implementation ? I came across the below code in a tutorial and I am wondering why inject the interface but register it as its implementation when you can just directly inject its…
Ferdinand
  • 513
  • 1
  • 3
  • 9
1
vote
1 answer

BlocBuilder's build method is not invoked when adding an event to this bloc from inside another bloc

I have bloc A, created and provided above all the widgets of my app. I have Bloc B, created and provided in screen 1. Bloc B has a reference to Bloc A and can add events to Bloc A inside mapEventToState of Bloc B. Now the weird thing: Inside screen…
HII
  • 3,420
  • 1
  • 14
  • 35
1
vote
0 answers

Angular Singleton Injectable service is not working

I have a service that I set as injectable that has a property that I want to share between two components. each component has a separate route here is my service: import { Injectable } from '@angular/core'; import { OAuthService,…
user955165
  • 447
  • 3
  • 8
  • 17
1
vote
1 answer

How to check if Injectable Value is set in Jackson Deserializer

I have a class that extends JsonDerserializer. In this deserialiser I have a concept of doing replacement values which I currently set using objectReader(Injectables). My problem is that sometimes I don't have injectables. I don't see a…
unknown
  • 125
  • 1
  • 8
1
vote
0 answers

Uncaught Error: Can't resolve all parameters for LoginService: (?, ?)

I am new to Angular 6. Ive seen a lot of bug reports in github but none would answer my question. I get this error which is under syntax error when I try to make a service that receives information from http. Uncaught Error: Can't resolve all…
Alexander Ho
  • 503
  • 2
  • 7
  • 18
1
vote
2 answers

Angular abstract class HttpClient injection

Hi everyone, i'm new with Angular and I am having troubles with Injectable classes. I have an abstract class (on web.ts) which one of its protected attributes is an HttpClient object. The definition of this abstract class is as follows: import {…
Salva Corts
  • 862
  • 1
  • 7
  • 12
1
vote
2 answers

Can't display data coming from service method into component

Still working on my Angular 5 - PHP project. I want to put all my http methods inside a single file called api, and call any method I want by just importing it into the desired component. I don't know if it's good to work like that or not. Anyway,…
alim1990
  • 4,656
  • 12
  • 67
  • 130
1
vote
1 answer

Angular 2/Typescript share (dynamic) data between pages

Alright, this question is probably asked quit alot, but I am still going to ask. I am new to Typescript/Angular 2. I have two pages, lets say Page A and Page B On page A i use api A to request data. After retreiving the data, the user can click on a…
1
vote
1 answer

angular service by @injectable and by es6 module

In angular we need to create @Injactable service class and provide it to our project. In theory we can import es6 module that executes as singleton service as well. Except that this is not "the angular way", why this method is not so common? angular…
1
vote
1 answer

Can't resolve parameters for a component from inside an injectable

I'm trying to import a component into my injectable service, but it seems that I'm doing something wrong. This happens for other pages in similar situations as well. The current situation seems to happen because the LoginPage that I'm trying to…
Lightheaded
  • 644
  • 8
  • 23
1
vote
5 answers

Global variables Ionic 2

I'm having some difficulties with Ionic 2 and setting up global variables. The structure of my app is as follows: Main app | |--- Page1 (Info) |--- Page2 (Map) |--- Page3 (List) | |--- ItemTabsPage | …
Jumy Elerossë
  • 189
  • 2
  • 3
  • 12
1 2 3
8 9