Skip to content

Instantly share code, notes, and snippets.

View code-simple's full-sized avatar
🏠
Working from home

code-simple code-simple

🏠
Working from home
View GitHub Profile
@code-simple
code-simple / JSON2CSV.dart
Last active September 29, 2021 19:59
# Very Simplest Way to Create CSV Out of JSON, List Data, or Almost anything \n In this Example We will Make CSV of a JSON that has List<Map<String, dynamic>> Data
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) {
@code-simple
code-simple / people.json
Created September 28, 2021 21:06
Just Random Data
[
{
"id": 1,
"firstname": "Emiline",
"lastname": "Carville",
"email": "ecarville0@discuz.net",
"gender": "Genderfluid",
"job": "Professor",
"phone": "638-170-8548",
"language": "Kazakh"
@code-simple
code-simple / main.dart
Created October 18, 2020 11:05
How to use For Loop in Nested Map
// 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'));
}