Turns out the error was caused by the angular files becoming corrupted in the pub cache. As was pointed out here (https://groups.google.com/forum/#!topic/angular-dart/WiZuIwxTDb4) - thanks Günter! - the solution is to repair the pub cache by doing 'pub cache repair' or at least 'pub cache add angular'
how to start an angular.dart app
-
19-07-2023 - |
Question
I am on angulardart 0.11.0 and this is my code for main.dart:
library my_app_main;
import 'package:angular/angular.dart';
import 'package:angular/application_factory.dart';
import 'package:my_app/src/something.dart';
class MyModule extends Module {
MyModule() {
bind(MyAppCtrl);
bind(MyComp);
}
}
main() {
applicationFactory()
.addModule(new MyModule())
.run();
}
I get syntactic errors:
- angular.dart import is 'unused'
- 'Module' is an 'undefined class'
I have tried deleting and rebuilding the packages directory, pubspec file, etc. What is going on?
Solution 2
OTHER TIPS
angular.dart import is 'unused'
is just a warning, so you don't really need to worry about it.
You're seeing 'Module' is an 'undefined class'
because you're not importing the di library. Add
import 'package:di/di.dart';
to your imports and it should run.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow