afterSerialize method
Object?
afterSerialize(
- Object? object,
- FullType specifiedType
)
override
Implementation
@override
Object? afterSerialize(Object? object, FullType specifiedType) {
if (specifiedType.root != ContentString) {
return object;
}
if (object == null) {
return object;
}
if (object is! Map<String, dynamic>) {
throw StateError('ContentStringPlugin can only be applied to Map<String, dynamic>. '
'Please ensure the StandardJsonPlugin is applied and run before.');
}
final content = object['content'];
return jsonEncode(content);
}