I am trying to add offline capabilities to an angular dart project, running pub build but
Running pub build:pub.exe build
-----
Unhandled exception:
ProcessException: The system cannot find the file specified.
Command: pub.exe build
#0 _buildProjectIfEmptyOrOld (http://localhost:52940/pwa.dart:116)
<asynchronous suspension>
#1 main (http://localhost:52940/pwa.dart:40)
<asynchronous suspension>
#2 _startIsolate.<anonymous closure> (dart:isolate-
patch/isolate_patch.dart:263)
#3 _RawReceivePortImpl._handleMessage (dart:isolate-
patch/isolate_patch.dart:151)
main.dart
import 'package:angular/angular.dart';
import 'package:my_app/views/app_component/app_component.dart';
import 'package:pwa/client.dart' as pwa;
void main() {
bootstrap(AppComponent);
// register PWA ServiceWorker for offline caching.
new pwa.Client();
}
pubspec.yaml
dependencies:
pwa: ^0.1.2
At that point, the pwa is trying to run pub.exe build. I haven't tried it on Windows, only a friend reported it working, but it is entirely possible that pub.exe does no longer work (if it ever did), and it should have been pub all along (and in this case it is a Windows-related bug).
Suggested workaround:
run pub build
run pub run pwa
run pub build again
If the above works, let me know, and I'll fix it in a patch release.
Related
I am monitoring a serial device via a jpevulator:
jpnevulator --read --ascii --tty /dev/ttyACM0 --pty --pass --read --ascii --timing-print
jpnevulator: slave pts device is /dev/pts/3.
jpnevulator: Use --read or --write, but not both. Performing a read this time.
**strong text**
And I made a simple programm that sends a string and reads from the serial port as well:
import 'package:libserialport/libserialport.dart';
import 'dart:typed_data';
void main(List<String> arguments) {
final port = SerialPort("/dev/pts/3");
if (!port.openReadWrite()) {
print(SerialPort.lastError);
}
port.write(Uint8List.fromList("Lorem Ipsum".codeUnits));
final reader = SerialPortReader(port);
reader.stream.listen((data) {
print('received: $data');
});
}
But I get the error once I dart run it:
Building package executable...
Built serial:serial.
Unhandled exception:
SerialPortError: No such file or directory, errno = 2
#0 Util.call (package:libserialport/src/util.dart:39:7)
#1 _SerialPortImpl._init (package:libserialport/src/port.dart:221:10)
#2 new _SerialPortImpl (package:libserialport/src/port.dart:211:42)
#3 new SerialPort (package:libserialport/src/port.dart:72:38)
#4 main (file:///mnt/data/Kwdikas/dart/serial/bin/serial.dart:5:16)
#5 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
#6 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
Any idea why? I am running it on linux mint. I am using flutter installed dart that is shipped as snap:
$ whereis dart
dart: /usr/bin/dart /usr/lib/dart /snap/bin/dart
And I have installed it using classic confinement:
sudo snap install flutter --classic
I'm trying to take the iOS build of a Flutter project. No matter what I try it just gives me the following error:
error: Build input file cannot be found: '/Users/GoogleService-Info.plist' (in target 'Runner' from project 'Runner')
This is the set of commands I am trying to get the build with:
flutter pub get
flutter clean
flutter build ios (this gives the above error)
Here is my flutter doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.16.3-pre.67, on Mac OS X 10.15.3 19D76, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.4)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.43.2)
[!] Connected device
! Doctor found issues in 1 category.
The flutter build ios --verbose ends with following error:
Encountered error while building for the device.
#0 throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
#1 BuildIOSCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:93:7)
<asynchronous suspension>
#2 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:722:18)
#3 _rootRunUnary (dart:async/zone.dart:1155:38)
#4 _CustomZone.runUnary (dart:async/zone.dart:1048:19)
#5 _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
#6 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#7 Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#8 Future._completeWithValue (dart:async/future_impl.dart:526:5)
#9 Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:556:7)
#10 _rootRun (dart:async/zone.dart:1147:13)
#11 _CustomZone.run (dart:async/zone.dart:1040:19)
#12 _CustomZone.runGuarded (dart:async/zone.dart:942:7)
#13 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:982:23)
#14 _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
#15 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
#16 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#17 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
Here is the image of the folder structure. As you can see, there is no 'Users' folder that holds the Google plist. So, it is quite confusing why would the script try to copy the plist from a non-existing directory. Any advice to fix this would be highly appreciated. TIA :-)
Remove the GoogleService-Info.plist and then again add the file into the Runner directory using Xcode, then choose copy items if needed and add to target checkmark. I hope this will solve your problem.
Make sure the name of the file is correct, i.e: "GoogleService-info.plist"
Add it to the project in mac finder under the project name and then drag it into the project to reference it.
Finally, go to the file inspector for the plist file and tick the box under target membership to include it as part of the project.
Reference
I've cloned a new flutter project from git
When I try to run I get the following error
Error: Could not resolve the package 'application_flutter_todo' in 'package:application_flutter_todo/utils/constants/api.dart'.
../../.pub-cache/git/flutter_maximo_api-35d1fef13c59a0e7fb70a20916adf1f9d26eac02/lib/src/maximo_api.dart:5:8: Error: Not found:
'package:application_flutter_todo/utils/constants/api.dart'
import 'package:application_flutter_todo/utils/constants/api.dart';
^
Unhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:package%3Aapplication_flutter_todo%2Futils%2Fconstants%2Fapi.dart; message=StandardFileSystem only supports file:* and data:*
URIs)
#0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:33:7)
#1 asFileUri (package:vm/kernel_front_end.dart:604:37)
<asynchronous suspension>
#2 writeDepfile (package:vm/kernel_front_end.dart:799:21)
<asynchronous suspension>
#3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:472:15)
<asynchronous suspension>
#4 _FlutterFrontendCompiler.compile (package:flutter_frontend_server/server.dart:38:22)
#5 starter (package:flutter_frontend_server/server.dart:149:27)
#6 main (file:///b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:8:30)
#7 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:32)
#8 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
Failed to build bundle.
Failed to package /Users/Mohammad/Gemba/application_traxxion.
Could not build the precompiled application for the device.
It appears that your application still contains the default signing identifier.
Try replacing 'com.example' with your signing id in Xcode:
open ios/Runner.xcworkspace
Note that the current project doesn't have the import 'package:application_flutter_todo' statement.
That statement belongs to another app and is not in the current project that I'm trying to run.
I've tried,
1- flutter clean
2- updating flutter
3- updating packages
4- cleaning the product
5- cleaning the project
6- running the project from terminal, visual studio code, xcode all three gave the same result.
Nothing of the above have worked.
As the error implies, you should change your package name and BundleId for Android & iOS respectively. You shouldn't be using the default ones.
You can find how to do so here.
For the first time, I am using puppeteer with dart , here the simple code :
import 'package:puppeteer/puppeteer.dart';
main() async {
var browser = await puppeteer.launch();
await browser.close();
}
In pubspec yaml file:
dependencies:
puppeteer: ^1.16.1
websocket: ^0.0.5
# path: ^1.6.0
when I am trying to run this piece of code with dart command:
dart puppy1_test.dart
I am getting this exception :
Unhandled exception:
Exception: Websocket url not found
#0 _waitForWebSocketUrl (package:puppeteer/src/puppeteer.dart:311:3)
<asynchronous suspension>
#1 Puppeteer.launch (package:puppeteer/src/puppeteer.dart:170:30)
<asynchronous suspension>
#2 main (file:///D:/project/<removed>/dl/puppy1/test/puppy1_test.dart:7:33)
#3 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:307:19)
#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
I solved the problem by deleting the .local-chromium folder. In this folder the chrome application is stored.
I suspect that the reason was a version mismatch, because I updated the dart version, after the creation of the project.
I am trying to create a directory list on windows using dart but I get an error
Here is my code
void listerine(Directory pat){
//Directory root = new Directory(pat);
//var root = Directory.systemTemp;
pat.list(recursive: true, followLinks: false).listen((FileSystemEntity entity){
main(List<String> arguments){
var root = new Directory("C:\\");
print(root);
listerine(root);
}
Btw I am using android studio as an IDE.
I gives me this error.
I/flutter ( 7224): Directory: 'C:\'
E/flutter ( 7224): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter ( 7224): FileSystemException: Directory listing failed, path = 'C:\/' (OS Error: No such file or directory, errno = 2)
E/flutter ( 7224): #0 _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:1114:29)
E/flutter ( 7224): #1 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter ( 7224): #2 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
You have the question tagged as flutter but seems you are asking about a pure Dart program?
This code
import 'dart:io';
void listerine(Directory pat) async {
await for (var v in pat.list()) {
print(v);
}
}
main() {
listerine(new Directory("C:\\"));
}
produces what you'd expect on Windows, namely
Directory: 'C:\$Recycle.Bin'
Directory: 'C:\$WINDOWS.~BT'
Directory: 'C:\Apps'
...
Flutter uses a modified version of the Dart SDK replacing html support with the mobile rendering engine (skia).
The majority of Dart code can run in both versions, but not all. This means that you can re-use packages in Dart VM applications and in Flutter applications - but again not all. In particular, interacting with the browser or the platform are only available in their respective versions.
To interact with the Windows file system, you need the Dart VM version. Download this separately. As Günter says, to interact with the mobile file system in Flutter, use path_provider.