import 'dart:convert'; import 'package:moor/moor.dart'; /// Maps a [Map] of type [String], [T] into a [String] understood /// by the sqlite backend. class MapConverter extends TypeConverter, String> { @override Map mapToDart(fromDb) { if (fromDb == null) { return null; } return Map.from(jsonDecode(fromDb) ?? {}); } @override String mapToSql(value) { if (value == null) { return null; } return jsonEncode(value); } }