Skip to content

Instantly share code, notes, and snippets.

@kzlsahin
Last active February 20, 2025 13:44
Show Gist options
  • Save kzlsahin/c79a038cc30240c7c193d1730fa38bcd to your computer and use it in GitHub Desktop.
Save kzlsahin/c79a038cc30240c7c193d1730fa38bcd to your computer and use it in GitHub Desktop.
import 'dart:convert';
void main() {
print("Hello");
String str = """[{
"id": "0194b497-6636-772f-9295-ab209b8b6642",
"productName": "A.O. Smith Frezya 300 S Arıtmalı Su Sebili",
"brandName": "A.O. Smith",
"brandId": "0194b496-a212-79ac-9ba2-7e3a0aa67bd0",
"categoryName": "Su Sebili",
"categoryId": "018d32aa-0fa4-7292-9881-369b2e409b3a",
"imageUrl": "https://iksir-files.s3.us-east-1.amazonaws.com/beyaz_esya/su_sebili/0194b497-6636-772f-9295-ab209b8b6642.jpg",
"reviewCount": 9,
"overallGivenRating": 5,
"overallCalculatedRating": 5,
"featuredSeller": {
"sellerId": "0194b43d-7682-7ddc-8f16-9544549e5dab",
"sellerName": "sariyersiemens.com.tr",
"overallGivenRating": null,
"reviewCount": 0,
"lastPrice": 29229,
"url": "https://www.sariyersiemens.com.tr/urun/a-o-smith-frezya-300s-sebilli-su-aritma-cihazi",
"shop": "sariyersiemens.com.tr",
"platform": {
"id": "018d3819-590f-75cd-8323-42a07b537ab3",
"name": "trendyol",
"logoUrl": "https://iksir-files.s3.us-east-1.amazonaws.com/platform_logos/trendyol.svg"
}
}
}]""";
final List<dynamic> data = json.decode(str);
List<Map<String, dynamic>> searchResults = List<Map<String, dynamic>>.from(data);
double? n = searchResults[0]["overallCalculatedRating"];
print(n);
print("overallCalculatedRating: ${n ?? 0.0}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment