angulardart / angular

Fast and productive web framework provided by Dart
https://pub.dev/packages/angular
MIT License
1.83k stars 232 forks source link

angular-dart build serve error while running webdev serve #1984

Closed santubangalore closed 2 years ago

santubangalore commented 2 years ago

I have just created a angular-dart project using ngdart create webapp_1 command. Now when I move into the project folder, and try to run the project by: webdev serve command, I get this error:

[SEVERE] angular:angular on web/main.dart: Bad state: Unexpected diagnostics: C:\tools\dart-sdk\lib\core\int.dart:120:18 - Operator declarations must be preceded by the keyword 'operator'. C:\tools\dart-sdk\lib\core\int.dart:120:16 - Methods must have an explicit list of parameters. C:\tools\dart-sdk\lib\core\int.dart:120:18 - A function body must be provided

Here is my main.dart :

`import 'package:angular/angular.dart'; import 'package:webapp_1/app_component.template.dart' as ng;

void main() { runApp(ng.AppComponentNgFactory); }`

here is my pubspec file:

`name: webapp_1 description: A web app that uses AngularDart Components

version: 0.0.``

homepage: https://www.example.com

environment: sdk: '>=2.10.0 <3.0.0'

dependencies: angular: ^6.0.0 angular_components: ^1.0.2

dev_dependencies: angular_test: ^2.3.0 build_runner: ^1.9.0 build_test: ^1.0.0 build_web_compilers: ^2.10.0 meta: <1.7.0 # As of 07/12/2021, Dart throws errors if meta is 1.7.0 or above pedantic: ^1.9.0 test: ^1.6.3`

I have run dart pub get command already. I have dart 2.15, webdev installed.

Dart version: 2.15 AngularDart version: 1.0.3 OS: Windows 10.


GZGavinZhao commented 2 years ago

OK, maintainer of ngdart here, it's definitely my problem as I haven't upgraded the templates... It's likely because of the dependencies are too old, and directly upgrading them to a compatible version require changes to the template code. I will address it in a day or two.

GZGavinZhao commented 2 years ago

@santubangalore Fixed, run dart pub global activate ngdart and it should work now.