Skip to content

Instantly share code, notes, and snippets.

@ramanraja
ramanraja / main.dart
Last active September 24, 2023 15:03
Example of converting from/to a custom Dart class to JSON
// Conversion from/to JSON to String in Dart
// Also simple DIY conversion to a custom class object
import 'dart:convert';
class dto{
String name;
int age;
dto(this.name, this.age);
factory dto.fromJson(Map<String, dynamic>? jmap) {