I've only just started a Dart application (using AngularDart). When I import the AngularDart package I see a console error in Dartium.
import 'package:angular/angular.dart';
If I comment out the AngularDart import then I don't see the error.
It appears as though the intl library is being resolved from my web directory as its root. (e.g. web/packages/intl/src/temporary_debugging.dart instead of packages/intl/src/temporary_debugging.dart).
I also see this same error with an untouched version of the AngularDart tutorial so I'm wondering if this is a bug. I've played around with this tutorial before and I haven't seen this error until now.
In describing this error I found that in using the built in server in WebStrom 8 (EAP) I see this error, but when using WebStorm 7 the error doesn't occur. I'm going to file a bug with IntelliJ.
Related
I developed a flutter app on an Ubuntu machine and it works without problems on Android. Now I am trying to run it on iOS from a Mac but when I start debugging, I get several errors like the following:
/opt/flutter/.pub-cache/hosted/pub.dartlang.org/entry-0.0.2_2/ios/Classes/SwiftAnimateInPlugin.swift:4:14: error: invalid redeclaration of 'SwiftEntryPlugin'
public class SwiftEntryPlugin: NSObject, Flutter Plugin {
^
flutter doctor passes for Flutter, Xcode, and Connected device.
Flutter 2.2.0 - channel stable
Tools - Dart 2.13.0
I have checked this question but they are not using Flutter and the answers are not relevant as far as I can tell. What would cause this error and how might I resolve it?
Taking Nisanth Reddy's advice from the comment above and grepping for SwiftEntryPlugin: NSObject my search was narrowed down to 2 files. The files were ./my-app/ios/.symlinks/plugins/entry/ios/Classes/SwiftEntryPlugin.swift and ./my-app/ios/.symlinks/plugins/entry/ios/Classes/SwiftAnimateInPlugin.swift. After some trial and error, it seems like both files are required (the redundant one being required by a particular Flutter package I'm using, I think) but both had the exact same code in them so I removed all the code from one of the files but left the empty file sitting there in the directory and the problem was resolved.
While following tutorail - Angular-dart tutorial - Tour of Heroes - part 2
with using IntelliJ IDEA in Windows 10 while using chrome, I got following error(s) -
[SEVERE] build_web_compilers|entrypoint on web/main.dart (cached):
Unable to find modules for some sources, this is usually the result of either a
bad import, a missing dependency in a package (or possibly a dev_dependency
needs to move to a real dependency), or a build failure (if importing a
generated file).
Please check the following imports:
import 'package:angular_app/app_component.css.shim.dart' as import0; from angular_app|lib/app_component.template.dart at 12:1
[SEVERE] Failed after 1.3s
Serving web on http://localhost:53323
I have checked multiple times & I have replaced all - 5 files - namely
lib/app_component.css, lib/app_component.dart, lib/app_component.html, lib/src/hero.dart & lib/src/mock_heroes.dart from Review the app structure but I am still getting the above mentioned error & -
I could not find any app_component.template.dart
Nor could found any instance of imported package:angular_app/app_component.css.shim.dart or shim using IntelliJ Find in Path (Ctrl+Shift+F)
I have tried to delete build and rebuild.
I have also re-installed dart 2.1.0 using windows package manager & changed the location of dart-sdk accordingly in IntelliJ IDEA Settings/Dart, as for brief period I was getting dart-sdk error, but that is fixed.
This my first time asking question on stacksoverflow, but I have checked similar questions, could not resolve that issue.
the most likely reason for that build failure is due to the stylesUrls files not being found. This could be because the name in that array doesn't match the name in the file system or is not the expected place in the file system.
To confirm, I started from scratch, downloaded the quickstart-master.zip to get the project structure.
And followed the steps all the way through the step you were stuck on.
The only time I was able to generate that error while following the steps is when I added thestyleUrls: ['app_component.css'], to app_component.dart prior to creating the file.
I got the same:
[SEVERE] build_web_compilers|entrypoint on test/app_test.dart.browser_test.dart:
Unable to find modules for some sources, this is usually the result of either a
bad import, a missing dependency in a package (or possibly a dev_dependency
needs to move to a real dependency), or a build failure (if importing a
generated file).
Please check the following imports:
import 'package:angular_app/app_components.css.shim.dart' as import0; from angular_app|lib/app_component.template.dart at 12:1
Once i created the css file, the error went away and everything worked fine.
I completed the entire step you were up to and my app was working fine.
I then did as you did and copied each file from the step and replaced my work with it, still worked.
So confirm my hunch, i changed the name of the css file, and received the same error.
regarding app_component.template.dart that file is auto generated by dart and can be found in your project under .dart_tool/build/generated/angular_app/lib
I had a very similar problem. I ran webdev build and then webdev serve and it fixed it right up.
I recently stumbled across Dart, and got pretty excited about it because it almost feels like that perfect language I've always been looking for. I work with PHP at my job (Yes, I know, ew gross) as a web developer and was excited to try and build a web app using the language. Figured it couldn't be too hard as that's what Dart was originally made for. Turns out it more difficult than I though, and I can't even get off the ground. I was hoping someone else could help point me in the right direction.
So, I really haven't done any real coding in this project at all. I literally downloaded the Dart SDK, used stagehand to create web-simple project, then I added a bin/server.dart file to the project. The code in that file was pretty much taken straight out of the online documentation for the mojito package:
import 'package:mojito/mojito.dart';
main() {
var app = init();
app.router
..addStaticAssetHandler('/static');
app.start();
}
I added the dependency mojito: "^0.6.6" to the pubspec.yaml file as well of course. That's all I've done though, like I say, I haven't even managed to get off the ground yet.
When I run server.dart I get the following error:
'package:convert/src/percent/encoder.dart': malformed type: line 23 pos 13: cannot resolve class 'ChunkedConverter' from 'PercentEncoder'
I get the exact same error message if I try to build a server with the shelf_rest package instead of the mojito package.
A search of that error message doesn't bring up too much helpful info, though I found one forum where someone recommended adding convert: ^2.0.1 to the dependencies. Apparently there was a change made in that package that causes incompatibility with other packages. I tried that suggestion but it doesn't seem to be resolving the issue.
I'm certain the issue is some sort of dependency issue, I'm probably using a mix of dependencies that I guess just aren't meshing right. If someone could help me figure out what I'm doing wrong it would be much appreciated. I want to learn and start using Dart but obviously I'm not having such great luck with it...
Here's what the pubspec.yaml looks like in case it helps:
environment:
sdk: '>=1.24.0 <2.0.0'
dependencies:
shelf: ^0.6.0
mojito: "^0.6.6"
convert: ^2.0.1
dev_dependencies:
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers:
- dart_to_js_script_rewriter
The last version of mojito was uploaded in October 2016 and it seems abandoned. Since then, Dart has added Strong mode and begun transitioning to Dart 2. This included significant changes to the type system and updates to SDK libraries.
Additionally, transformers have also been removed - any documentation you find referencing them is out of date. And in this case, the dart2js script rewriter is for client side JavaScript, not servers.
If you're looking for Server libraries, I would recommend just starting with the latest version of Shelf
I'm porting an existing angular2 ts library to Dart.
Everything's working in Dartium but after building the app won't run in Chrome.
I'm getting an "The selector "demo-app" did not match any elements" error.
Not sure how to debug, any help would be appreciated!
Please see https://github.com/laagland/ng2-dart-pagination for the code.
- dart_to_js_script_rewriter
should be the last transformer.
Also add this setting to the Angular transformer
- angular2:
platform_directives: 'package:angular2/common.dart#CORE_DIRECTIVES'
See https://github.com/kwalrath/angular.io/blob/d87fb0995aafe5da1c2be708986d74828b65d55c/public/docs/_examples/forms/dart/pubspec.yaml for an example.
You should try to avoid mirrors in browser applications because it causes code bloat. I didn't chech all your code, but I saw the #MirrorsUsed annotation. If you need reflection, use the reflectable package instead.
I have a project that was building fine a few days ago, since then I haven't changed my dart-sdk or any library dependencies or update dart editor to my knowledge, I just made a very small change to one of my polymer elements to use paper-buttons instead of standard buttons, the change can be seen here
Now when I run pub build I get the following errors, and I have no idea why, if I look in packages polymer/polymer.dart does exist and dart editor doesn't show any warnings in the project. similarly if I undo my latest changes and go back to my last working version I still get this exact same error, so I'm not sure how to debug this, any hints would be much appreciated.
Can't read 'package:polymer/polymer.dart' (Could not find asset polymer|lib/polymer.dart.).
import 'package:polymer/polymer.dart';
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For such weird problems it's often a good idea to try pub cache repair.
I found an open issue with the same error message: http://dartbug.com/20285
Check if pub get or pub upgrade show some warnings, errors, ...