Async/await dart support on Chrome Dev Editor - asynchronous

Dart recently added a support for async/await keywords:
https://www.dartlang.org/articles/await-async/
I tried to run a simple code but Chrome Dev Editor does not recognise async keyword
import 'dart:async';
void main() async {
}
Am I doing something wrong (something to modify in the pubspec.yaml ?) or is it just that this feature is not supported yet on Chrome Dev Editor ?
Edit:
Ok, so for know it seem that async/await seems to be more an experimental feature:
https://www.dartlang.org/docs/dart-up-and-running/ch02.html#async-opt-in
To opt into asynchrony support in Dart Editor, go to Preferences, click Experimental, and select Enable Async Support.
In dart and dartanalyzer, use the --enable-async command-line flag:
dart --enable-async async_await.dart
dartanalyzer --enable-async async_await.dart
Unfortunatly, it seems only to work for Dart Editor, not CDE.
Also, dart does not currently support the conversion into javascript without adding a package:
dependencies:
async_await:
git: https://github.com/dart-lang/async_await.git
transformers:
- async_await

So currently it's not supported.
Now there is an issue on this problem: https://github.com/dart-lang/chromedeveditor/issues/3822
Thank you for all your answer
Wait & see...

Did you import the async module?
From the page you linked:
The features described in this article are still under development. Not all the parts of the system necessarily comply with the spec. Early adopters may need to import dart:async for these features to work. Ultimately, Future should move to dart:core and be universally available.

I'm on my Chromebook right now (and can't verify), but I believe you have to enable it under experimental features in the settings.

I don't know whether this helps with CDE, but the Asynchrony part of the Dart language tour has some information on opting in to asynchrony support for other tools.

Related

OpenAPI specification File of HERE Routing API v8 (8.27.0) not valid

I tried to use the OpenAPI Service Ref in Visual Studio 2019 to import the HERE Routing API Specification file into my Solution. But this didn't work. (obscure error code -1) As I tried to figure it out, I used a couple of other API tools, and found out that the reference on line 272 seemed wrogly formatted.
I changed this:
LineString: "../shared/common.yaml#/components/schemas/LineString" to LineString: "#/components/schemas/LineString"
The file is now imported and the classes are created. But now I am also having build errors because class Price isn't defined...
I have a feeling that this yaml file has a few hickups ;)
Hope you guys get it resolved.
The development team is looking at this issue and I will keep updated here.
Update: This issue has been addressed and worked on with priority by the development team. So far the OpenAOI Spec doesn't support code generating.

Sqlite with Flutter Desktop Windows?

the app is work with android but not work with desktop
[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: MissingPluginException(No implementation fou
nd for method getDatabasesPath on channel com.tekartik.sqflite)
As pointed in a comment sqflite_common_ffi allows using sqflite API on Desktop. It is not implemented as a flutter plugin as it also works in a regular dart VM.
You might read this to see how to use your existing sqflite code on desktop. But since it is always better to explain a little bit more than adding a link, here are the basic steps:
Setup
First add the dependency:
dependencies:
sqflite_common_ffi:
Initialization
Then initialize ffi before running your app:
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:sqflite/sqflite.dart';
Future main() async {
if (Platform.isWindows || Platform.isLinux) {
// Initialize FFI
sqfliteFfiInit();
// Change the default factory
databaseFactory = databaseFactoryFfi;
}
runApp(MyApp());
}
Currently the sqflite only supports Android Ios and Mac.
Alternatively, you can either use Hive or sembast.
If you want to perform queries on the database I suggest you use sembast.
both the packages currently supports all the platform however if you are using sembast you have to include the package sembast_web for web support.
Packages:
Hive: https://pub.dev/packages/hive
Sembast: https://pub.dev/packages/sembast
Sembast_web: https://pub.dev/packages/sembast_web
As #alextk noted, you can use sqflite_common_ffi, to get the Windows support you desire. Depending on your requirements, a pure Dart option may be a better alternative though.
If you just want to store key/value pairs, Hive is probably the way to go, but if you want to store objects, ObjectBox is probably your best bet.
Here is a good article which contains a comparison of existing storage technologies for Flutter:
https://objectbox.io/flutter-databases-sqflite-hive-objectbox-and-moor/

Unity 5.6: Google Play Services and Firebase Messaging plugins not compatible

I'm cannot make a build after installing both the Google Play Services plugin and the Firebase Messaging plugin. I'm using the latest versions of both. I get the "Unable to convert classes into dex format" error. The two libraries that conflict are play-services-auth-10.2.6 and play-services-base-11.2.0. Google Play Services resolver grabs these two libraries for me. Anyone have a solution?
I've been messing around with the GPGSDependencies.xml and the PluginVersion.cs file from the google play services plugin. I was attempting to make the library versions identical.
I did manage to get identical library versions, this did solve the DEX format issue, but when I made a call for authenticating a google account my app crashed.
This is what I did:
In GPGSDependencies.xml I changed the 10+ in these lines to 11.1+
<androidPackage spec="com.google.android.gms:play-services-games:10+">
...
<androidPackage spec="com.google.android.gms:play-services-nearby:10+">
...
<androidPackage spec="com.google.android.gms:play-services-auth:10+">
And I also changed the lines in PluginVersion.cs to
// used to check for the correct min version or play services: 11.2
public const int MinGmsCoreVersionCode = 11200000;
// used to get the right version of dependencies.
public const string PlayServicesVersionConstraint = "11.1+";
from
// used to check for the correct min version or play services: 10.2
public const int MinGmsCoreVersionCode = 10200000;
// used to get the right version of dependencies.
public const string PlayServicesVersionConstraint = "10+";
The PluginVersion.cs alteration was mentioned here:
https://github.com/playgameservices/play-games-plugin-for-unity/issues/1892#issuecomment-325555313.
This didn't solve all my problems but maybe it will help you.
Let me know if you managed to solve it, I am still working on a solution.
I got it to work with the latest google play services resolver.
https://github.com/googlesamples/unity-jar-resolver

Cannot import Firebase project

I have an existing Firebase project that I am trying to import into the new Firebase 3.0 version that was just released at Google I/O 2016. Every time I try to import it, I keep getting this error with no helpful message on how to fix it or what the actual problem is.
It Sometimes related to your extensions that you have added them before for example I had Enable Cross Origin * Extension and Firebase did nothing at all.
Sorry you've had trouble! No open-and-shut answer here, but some things you can check:
Firebase has been popular this week, so we've had a fair bit of load. Try importing the project again and see if it works.
There is a known issue where projects with very short names may not import. That's being worked on - so if you have one of those projects, please check in later!
A Firebase project in the new console is also a Google Developers/Google Cloud console project. There is a limit to how many of those you can have.
To check if its the third case, try going to http://console.developers.google.com and see how many projects you have. If its a few (double digits) you may be hitting this issue. You can delete any unused projects and then try and import again. Unfortunately you may have to wait a bit as projects can be un-deleted, so the slot isn't made available immediately.
If none of this fits you, then it may be something new! Try filing a ticket with the support team and include the details of your project: https://firebase.google.com/support/contact/troubleshooting/

Firebase client on ReactNative

When using Firebase on ReactNative, it will show such error message:
can't find variable process
However, if I require firebase/lib/firebase-web.js manually, it will show:
can't find variable document
How can I resolve this?
I just went through the same issue while trying to use sockets.io in my react native app so hopefully I can help.
The reason that you cannot use firebase's node module is because there hasn't been a polyfill created yet for websockets support (which firebase is dependent on) in react native.
If you take a look at issue #619 in react native's repo you'll find the current discussion on creating a websockets api polyfill.
The way that we solved it is by using Jason's modified version of the sockets library and creating our own repo around just that file. Then we added the line below to our package.json dependencies.
"react-sockets": "crewapp/react-native-sockets-io"
The reason that Jason's version of the sockets.io client file works is because react-native is added as a user agent. You can find the code that makes this change at the top of the file:
window.navigator = {
userAgent: "react-native"
}
Once you've gone through these steps you should be able to require sockets.io / firebase as normal.
Just figuring it our. Pavan's answer is helpful, but it is not quite true when using with Firebase.
For firebase, please follow the steps:
Download the firebase-debug.js from wsExample. Or you can just install wsExample by npm and require the firebase-debug.js inside it.
Use badfortrains's forked React-Native:
"react-native": "git://github.com/badfortrains/react-native#WebSocket"
New the Firebase like this:
var firebase = require("../../firebase-debug.js");
var rootRef = new Firebase(Const.FB_ROOT);
Things should just work now!
I had issues with socket.io on React Native too, solution was to get notifications about new data and if data is big enough - get it by simple RESTfull request. in my case data was small enough to be sent all within notifications API.
I was using GCM service to send notification to phone from nodejs server. BTW, it uses less battery then socket connection and works great :)

Resources