Open p554157atch opened 4 years ago
While working on a project, dependency injection in Angular Dart was not working. I spend few 3-4 hours debugging this issue at the end I found that:
dart:html and http package export class Client and they were colliding with each other and DI was not able to provide the right class.
dart:html
http
Client
I was developing in a rush and did not pay attention to this.
Many other users were having similar issues: https://github.com/dart-lang/angular/issues/1847 https://github.com/dart-lang/angular/issues/1851 https://stackoverflow.com/questions/57420313/import-darthtml-in-service-got-exception-no-provider-found-for-dynamic
It might be a good idea to add a new rule in the analyzer plugin strict_named_imports, similar to how Golang does its imports with 0 name collisions.
strict_named_imports
I would like to keep this rule enabled by default on all of my projects so that name collision issues can be avoided.
This is just a suggestion.
have been there too.
While working on a project, dependency injection in Angular Dart was not working. I spend few 3-4 hours debugging this issue at the end I found that:
dart:html
andhttp
package export classClient
and they were colliding with each other and DI was not able to provide the right class.I was developing in a rush and did not pay attention to this.
Many other users were having similar issues: https://github.com/dart-lang/angular/issues/1847 https://github.com/dart-lang/angular/issues/1851 https://stackoverflow.com/questions/57420313/import-darthtml-in-service-got-exception-no-provider-found-for-dynamic
It might be a good idea to add a new rule in the analyzer plugin
strict_named_imports
, similar to how Golang does its imports with 0 name collisions.I would like to keep this rule enabled by default on all of my projects so that name collision issues can be avoided.
This is just a suggestion.