1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] using get_it with isolates

Discussão em 'Mobile' iniciado por Stack, Outubro 9, 2024 às 17:32.

  1. Stack

    Stack Membro Participativo

    I am new to both dart and flutter. Working on a project where I download some resources from a remote server using isolates. All works fine. I wrote some tests already but I also want to add a test case to cover a network problem. In order to to that, I want to mock up Http.Client() instance used in isolate with a mock object. In order to use dependency injection, I have been trying to use get_it. After a couple of hours, it occurred to me that where I register http.Client() code is not shared with the isolate as isolate and the main isolate do not share the same memory.

    I am sure I am not the first one dealing with this problem. So what I am asking for is some recommendations from more experienced flutter(/dart) developers about how to approach this testing issue.

    All suggestions are highly appreciated. Thank you.

    Continue reading...

Compartilhe esta Página