3

When refactoring my code and when executing build_runner, I received out of a sudden loads of errors alike

[SEVERE] injectable_generator:injectable_builder on lib/application/authorization/xxx data_sync/sync_data.dart (cached):

type 'UnspecifiedInvalidResult' is not a subtype of type 'LibraryElementResult' in type cast

As can be seen, they result from the injectable package.

w461
  • 2,168
  • 4
  • 14
  • 40

2 Answers2

5

In my case, I was receiving a similar error:

[SEVERE] injectable_generator:injectable_config_builder on lib/main/di/dependency_injection.dart (cached):

Stack Overflow
[SEVERE] Failed after 118ms
pub finished with exit code 1

I figured out my problem was ocurring because I had cyclic injections...meaning that I was injecting into my interceptor a class that had injected a Dio client inside itself...it was an obvious loop, so I had to delete the injected class.

I'm not sure this is relevant, but I posted an answer since there's no more information online about this error...

Ramiro G.M.
  • 357
  • 4
  • 7
1

This is caused by blanks in the directory names. I had added xxx upfront to the names of directories yet to be refactored.

So changing xxx data_sync to xxx_data_sync fixed the issue. The fun part, I am refactoring towards clean architecture and used dirty folder names going forward...

w461
  • 2,168
  • 4
  • 14
  • 40