Skip to content

How I can get a lazySinglton from another isolate #57

Closed
@Reekoooo

Description

@Reekoooo

suppose I registered a repo like this

sl.registerLazySingleton<CalenderMonthRepository>(()=>CalenderMonthRepositoryImpl(
   local: sl(),
   remote: sl(),
   location: sl(),
   notificationsDataSource: sl(),

all local, remote,location and notificationsDataSource are lazySingletons too,

I have this static function

static Future<CalenderMonth> getCalenderMonth(CalenderMonthRepository repository ) async{
//use repository
  }

and I am calling compute function like this

CalenderMonth calenderMonth= await compute(getCalenderMonth,repository);

the issue is when I pass it to another isolate via dart compute function which should run on another isolate I get error of not reachable code .

the question is how to use lazySingletons like these on other isolates ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions