I'm using a json file to store my data and I need to show some of it on the screen.
For example, when I make a simple text widget and use this string:
Text("a\u2081")
It shows "a" with a subscripted "1".
The problem is that when I load it from a json file it just shows "a\u2081".
This is how I load the data:
var myData = await rootBundle.loadString("data/my_data.json");
var data = await json.decode(myData.toString());
I'm storing the values in objects:
Text(TestReport[i].text) // where TestReport[i].text = "a\u2081"
Is there a way how to show the subscript?
Related
Temperature=37 , humidity = 60 //data from api
String read =
"humblehacks.xyz/Server.php?patient=Yassen%20Mohamed&request=REQUEST_DATA_DAWNLOAD";
http.Response jread = await http.get(Uri.parse(read));
if (jread.statusCode == 200) {
var body = jread.body;
I am using api to get data , but not by json or xml just string ,
How do I show the data , I can't use Jsondecode because ABI is not Json
i want to display 37 and 60 in app , how can i display it I want full code
Output widgets like text should suffice
Text(37.toString()), // Simple value
Text("Temperature $val"), //String and variable
Text("Temperature ${temp.val}"),//String and map item
I am using firestore to retrieve data
List<Data> userSearchItems = [];
...........
for (var i = 0; i<userDocument['order'].length; i++)...[
Text(userDocument["order"][i].toString()),
userSearchItems.add(userDocument["order"][i].toString()),//This do not work a read line appears with error
],
errors seen for userDocument["order"][i].toString()
The argument type 'String' can't be assigned to the parameter type 'Data'
and a red line also appears at add
Using for loop i can get the Text but i want to store it in an array or list (what is most suitable) to be used later to get data from firestore that match a list/array item that has been fetched before
Found the solution
You can implement a new method for it
var arr=List();
void addList() {
FirebaseFirestore.instance.collection("points").doc('1').get().then((value){
arr.addAll(value['order']);
});
}
and the list can be used in any other function
I am getting the data from my JSON file through this code:
var content = await rootBundle.loadString("json/story1.json");
decodedContent = json.decode(content);
And I would like to be able to store an integer inside the story1.json file.
I have:
Raw xml filled by a select query.This xml transformed into a HL7
message
One of the tags of this xml represents a clob column from a table in
the database
I mapped this data (from edit transformer section) as a variable.
Now I am trying to convert this variable into a base64 string then
replace it in my transformed hl7 message.
5.I tried this conversion on a destination channel which is a javascript writer.
I read and tried several conversion methods like
Packages.org.apache.commons.codec.binary.Base64.encodeBase64String();
I have got only error messages like :
EvaluatorException: Can't find method org.apache.commons.codec.binary.Base64.encodeBase64String(java.lang.String);
Code piece:
var ads=$('V_REPORT_CLOB');
var encoded = Packages.org.apache.commons.codec.binary.Base64.encodeBase64String(ads.toString());
It is pretty clear that I am a newbie on that.How can I manage to do this conversion ?
Here is what I use for Base64 encoding a string with your var substituted.
//Encode Base 64//
var ads = $('V_REPORT_CLOB');
var adsLength = ads.length;
var base64Bytes = [];
for(i = 0; i < adsLength;i++){
base64Bytes.push(ads.charCodeAt(i));
}
var encodedData = FileUtil.encode(base64Bytes);
I'm using Papa.unparse() to convert a JSON object to csv then downloading the file. The method fails with:
"allocation size overflow papaparse.min.js:6:1580"
This happens in firefox when there's > than 500,000 items to unparse in the JSON array.
The Papa.parse() method allows you to stream data from a file. Is there any similar approach you can take for Papa.unparse()?
You don't need PapaParse to do this.
The allocation size overflow problem is from converting your 500,000 rows into 500,000 strings and concatenating them together to form one massive string to create the CSV file with. JavaScript creates a new String when you concatenate one or more together, and eventually you run out of memory and crash.
The solution is to use TextEncoder to encode your strings into utf-8 (or whatever you need) ArrayBuffers, push each one into a giant array, and then use that array to create your file.
Here's some rough code for how you might do that:
var textEncoder = new TextEncoder("utf-8");
var headers = ["header1","header2","header3"];
var row1 = ["column1-1","column1-2","column1-3"];
var row2 = ["column2-1","column-2-2","column2-3"];
var data = [headers,row1,row2];
var arrayBuffers = [];
var csvString = '';
var encodedString = null;
var file = null;
for(var x=0;x<data.length;x++){
csvString = data[x].join(",").concat('\r\n');
encodedString = textEncoder.encode(csvString);
arrayBuffers.push(encodedString);
}
file = new File(arrayBuffers,"yourCsvFile.csv",{ type: "text/csv" });
I use text-encoding for a TextEncoder polyfill, and presumably if you're trying to Papa.unparse you've got FileAPI already.