Accessing device SMS in flutter - dart

I am trying to create a flutter app that reads the device SMS and stores them in a list. for this, I am using this library:https://pub.dartlang.org/documentation/sms/latest/
but the code provided in the documentation throws the following errors:
only static members can be accessed in initializers.dart(implicit_this_reference_in_initializer)
A value of type Future<List<SmsMessage>> can't be assigned to a variable of type List<SmsMessage>.dart(invalid_assignment)
Inorder to avoid this error I have tried adding List to Future> type annotation but first error still remains
Can someone provide me a proper way of doing this? Also if there is a better way of doing this? I am pretty new to flutter so I would request you to try to keep the explanations simple.
Thanks in advance.
This is the code in the documentation:
SmsQuery query = SmsQuery();
List<SmsMessage> messages = query.getAllSms;

Related

readMask value to get the display names form new GMB API

I am running this line of code:
location_list = self.service_mbbi_v1.accounts().locations().list(parent=account_name,readMask='name').execute()
And I get the list of the location IDs but I don't manage to get the Location display name, the display name, not just the ID. I wrote google and told them about my issue and they told me they are looking into it but it has been 2 weeks and no response yet. So just wanted o see if someone else had the same issue and if they fpund a solution or a workaround.
The documentation provides only an example, not a list of possible values:
https://developers.google.com/my-business/reference/businessinformation/rest/v1/accounts.locations/list
And even when I try the example value of the readMask flag I get an error:
[{'#type': 'type.googleapis.com/google.rpc.BadRequest', 'fieldViolations': [{'field': 'read_mask', 'description': 'Invalid field mask provided'}]}]">
I found this similar question:
Google Business Profile API readMask
The example they provide work for me but I still can't get the display name value.
I thought of using the google place ID I get from the metadata response and see if I can use another API to find the name but it feels they should be a proper 'readMask' string vale for the display name here and it is not 'displayName'..
Has anyone a hint of what can I do?
Thanks a lot
If you are trying to get the business name data, your readMask should be 'title'.

Is it possible to unlink a linked record using the Relay Modern imperative mutation API?

I would like write a mutation updater that unlinks a linked record from another record.
For example, suppose I have the following in my store:
client:root {
user: {__ref: "someid"}
}
I am looking for a way to unlink user and client:root. user is a nullable field. I would like subscribers that are interested in the user field to see it has gone null.
Right now the only way I am seeing to unlink this field is to delete the node from the store. I've tried setting the link to null using setLinkedRecord but that throws an error.
.setLinkedRecored() expects the first argument to be an instance of RecordProxy. Use .setValue() for unlinking nodes, as whitep4nther commented above.
store.getRoot().setValue(undefined, 'user');
I was just fighting with this as well, and after digging through the relay codebase, I decided there isn't an appropriate way to go about this right now. I've opened an issue here.

Proper way to return error from within a mutateAndGetPayload

I am doing a number of business logic checks within the mutateAndGetPayload function of a relay mutation using the graphql-relay library. For any of these checks that fail I have an else clause that will throw an error, ig throw('You do not have permission to delete this resource');, however, when that happens, I get the error Cannot set property 'clientMutationId' of undefined returned to the frontend instead of the error I'm trying to return. It seems that I'm seeing this error because I'm not returning something this mutation cares about (or a promise that resolves to one), so I'm a little stumped ... what's the proper way to throw/return errors back to the client here?
One way is to use the GraphQLError Type
Working in NodeJS on the back end we have used the following library:
https://github.com/graphql/graphql-js/tree/master/src/error
However, what we have ended up using is a library that provides more flexibility:
https://github.com/kadirahq/graphql-errors
Either of these would be the best place to start.

F# Type providers and Sky Biometry

Has anyone used the F# type providers with Sky Biometry?
A majority of the calls work great with the type providers. However, when I call the faces/recognize method, I am getting fails using both the Json and the Xml type provider.
Using the Json one, I declare the type like this:
type skybiometryJsonFaceRecognition = JsonProvider<"http://api.skybiometry.com/fc/faces/recognize.json?uids=default#ImageComparer&urls=https://lg2014dev.blob.core.windows.net/d69bdda9-d934-448c-acae-99019f3a564f/01ee184f-ff0b-426f-872a-cbc81ef58d90.jpg&api_key=XXXXX&api_secret=yyyyy">
When I try and use the type in my code, it is failing on the last part of the graph:
let recognition = skybiometryJsonFaceRecognition.Load(stringBuilder.ToString())
It should be:
recognition.Photos.[0].Tags.[0].Uids.[0].confidence
But instead I get:
recognition.Photos.[0].Tags.[0].Uids.[0].JsonValue
I then swapped over to the Xml type provider for just this one call and I am getting intellisense working:
let recognition = skybiometryXmlFaceRecognition.Load(stringBuilder.ToString())
recognition.Photos.Photo.Tags.Tag.Uids.Uid.Confidence
But when I run it, I get
System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
Looking at the XML in a call from my browser, it sure looks fine to me:
Does anyone have any suggestions? Thanks
Thanks to ntr's suggestion, I changed the type def to use local storage. The Json TP then found all of the props and the actual call worked as expected. Thanks everyone.

Metadata bug in Breeze 1.3.1? (Inheritence)

Trying out Breeze 1.3.1 and we've hit a problem. When trying to load the metadata, we get this error:
"Error: Metadata import failed for api/securitychart/Metadata; Unable to process returned metadata:Unable to locate a 'Type' by the name: Vehicle:#Project.Model.Entities"
Just for clarification, the entity "Vehicle" is the base type from which two other entities "Motorbike" and "Car" inherit.
We've digged up a bit through Breeze's code and found that the JSON returned from the ContextProvider.Metadata() method returns the array of entityTypes in the following order:
And the error pops out when trying to parse then entity data for Motorbike.
Without having much idea what was going on, we guessed that the base class Vehicle was not available when trying to parse the metadata for Motorbike, so we manipulated the array to let it process first the base class Vehicle. After doing this, this error no longer appears, but there's a different one: "bad navigation properties".
Can you guys please give us a clue about how to proceed from here?
Edit: As of v 1.3.2, this bug should be fixed. Please post back here to either confirm that it works or that you still have an issue.
Edit: Ok, this is a bug and will be fixed in the next release. And thanks for the repro metadata, it really helped.
Can you send me an email with the "broken" metadata ( the json returned from the server) at breeze.ideablade.com ( with Attn: Jay Traband somewhere in the email). and I'll try to get back to you as soon as possible.

Resources