How to use ServerValue in FirebaseDatabase plugin for Flutter - firebase-realtime-database

How to use the ServerValue on this page and here they say the timestamp is implemented for firebase_database

Use ServerValue.timestamp to set time
DatabaseReference.set({
'time': ServerValue.timestamp,
}).

Related

couchbase consistency in node.js sdk 3

in couchbase SDK version 3 I can't find consistency set in the insert and find query like java
N1qlParams adhoc2 = N1qlParams.build().consistency(ScanConsistency.STATEMENT_PLUS).adhoc(true);
is that deprecated?
and if it's deprecated how can I fix this problem?
regards.
checkout options of cluster.query()
https://docs.couchbase.com/sdk-api/couchbase-node-client/Cluster.html#query
Check out the class QueryScanConsistency
cluster.query(queryString, QueryOptions.queryOptions()
.scanConsistency(QueryScanConsistency.REQUEST_PLUS) )
.rowsAs(MyEntity.class)
You should use REQUEST_PLUS instead of STATEMENT_PLUS

The getEntityAttributes() function in Thingsboard

I am trying to use the attributeService.getEntityAttributes function to obtain some server attributes of my device. I was using the .getEntityAttributesValues function when working with the 2.x version of Thingsboard and it was working fine. With the current version I am using the following code:
var conf = {
ignoreLoading: false,
ignoreErrors: true,
resendRequest: true
};
var myattr = attributeService.getEntityAttributes(entityID,'SERVER_SCOPE',["myattribute"],conf);
But I get no data or error back. I was using the .getEntityAttributesValues with .then() method but it doesn't seem to work anymore. It says ".then is not a function".
What am I doing wrong? Please help and tell me how to use the new function properly. I am using TB v.3.1.1 CE.
Thingsboard 2.x UI was made with AngularJS.
Thingsboard 3.x UI now uses Angular.
One of the key differences between these frameworks in regards of your problem is the move from Promise based services, to Observable based services.
Let's look at the source of the getEntityAttributes function:
https://github.com/thingsboard/thingsboard/blob/2488154d275bd8e6883baabba5519be78d6b088d/ui-ngx/src/app/core/http/attribute.service.ts
It's mostly a thin wrapper around a network call made with the http.get method from Angular.
Therefore, if we have a look at the official documentation: https://angular.io/guide/http#requesting-data-from-a-server, it is mentioned that we must subscribe to the observable in order to handle the response. So something along the lines of:
attributeService.getEntityAttributes(entityID,'SERVER_SCOPE',["myattribute"],conf).subscribe((attributes) => {…})

Analyzer option for using const

Is there an analyzer option I can use in analysis_options.yaml that will notify me when I could use the const keyword? It would be nice to be notified about all the places in my code where I can use it.
There are a few dartanalyzer lints related to const:
prefer_const_constructors
prefer_const_constructors_in_immutables
prefer_const_declarations
prefer_const_literals_to_create_immutables
Also:
unnecessary_const
You can see the full list of supported lint rules.
What you're looking for is prefer_const_constructors

How to make --no-packages-dir the default for dart pub in WebStorm?

Dart 1.19.0-dev supports a new flag --no-packages-dir that replaces --no-package-symlinks. Is there any way to make this the default in WebStorm?
There is no way.
We have to wait until it becomes the default in pub
https://youtrack.jetbrains.com/issue/WEB-18006

Does Leshan support ObjLink?

I am trying to create my composite LWM2M object by using objlink type.
For Leshan, the only source on how to write the spec file in JSON seems to be the official oma-objects-spec.json, which does not contain examples of objlinks.
Can anyone provide an example on how to create an objlink object?
If it is not possible in Leshan, have anyone tried other implementations?
Hope it's not too late.
As of now there is no support of OBJLNK in Leshan API.
I was also needed OBJLNK support in Leshan so i have modified and created a pull request for supporting OBJLNK.
If you want to have objlnk support can use my branch which is forked from Leshan.
https://github.com/DevendraKurre/leshan
Leshan has added support to this feature. I have tested it with version 0.1.11-M14.
Reading can be done as usual, and writing is done as follows.
WriteRequest writeReq = new WriteRequest(
WriteRequest.Mode.UPDATE,
9, 0,
LwM2mSingleResource.newObjectLinkResource(
13,
new ObjectLink(5566, 7788)
)
);

Resources