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