This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:convert'; | |
| import 'dart:io'; | |
| // This Will extract data from JSON file and Create CSV file. | |
| // people.json DownloadLink : https://gist.githubusercontent.com/code-simple/dff6ec9eaa0816131d7273578f38c3e1/raw/6c8e8b9bb36003c2f3b9ca3cefc8a4bcfe2910eb/people.json | |
| // new.csv DownloadLink : https://gist.githubusercontent.com/code-simple/7cae32a464f8a9995a6e510528edc576/raw/d31870b6dac5781ac4ee1d203e66334320bfec96/new.csv | |
| void main() { | |
| // Read CSV [Simple CSV that has first row header, and data in next rows] | |
| List<Map<dynamic, dynamic>> readCSV(String fileName) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "id": 1, | |
| "firstname": "Emiline", | |
| "lastname": "Carville", | |
| "email": "ecarville0@discuz.net", | |
| "gender": "Genderfluid", | |
| "job": "Professor", | |
| "phone": "638-170-8548", | |
| "language": "Kazakh" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // How to use For Loop in Nested Map | |
| void main() { | |
| var people = {1: {'Name': 'John', 'Age': '27', 'Sex': 'Male'}, | |
| 2: {'Name': 'Marie', 'Age': '22', 'Sex': 'Female'}}; | |
| for(int i=1;i<=people.length;i++){ | |
| print('\nPerson ID: ${i}'); | |
| people[i].forEach((k,v)=>print('$k : $v')); | |
| } |
NewerOlder