Solian/lib/providers/database/tables/json.dart

14 lines
282 B
Dart
Raw Permalink Normal View History

2024-09-13 16:30:33 +00:00
import 'dart:convert';
import 'package:drift/drift.dart';
class JsonConverter extends TypeConverter<Object?, String> {
const JsonConverter();
@override
Object? fromSql(String fromDb) => jsonDecode(fromDb);
@override
String toSql(Object? value) => jsonEncode(value);
}