toJson<T> static method

T? toJson<T>(
  1. Object? o, {
  2. JsonFieldMatcher? maskField,
  3. String maskText = '***',
  4. JsonFieldMatcher? removeField,
  5. bool removeNullFields = false,
  6. ToEncodableJsonProvider? toEncodableProvider,
  7. ToEncodable? toEncodable,
  8. EntityHandlerProvider? entityHandlerProvider,
  9. EntityCache? entityCache,
  10. bool? autoResetEntityCache,
})

Converts o to a JSON collection/data.

  • maskField when preset indicates if a field value should be masked with maskText.

Implementation

static T? toJson<T>(Object? o,
    {JsonFieldMatcher? maskField,
    String maskText = '***',
    JsonFieldMatcher? removeField,
    bool removeNullFields = false,
    ToEncodableJsonProvider? toEncodableProvider,
    ToEncodable? toEncodable,
    EntityHandlerProvider? entityHandlerProvider,
    EntityCache? entityCache,
    bool? autoResetEntityCache}) {
  var jsonCodec = _buildJsonEncoder(
      maskField,
      maskText,
      removeField,
      removeNullFields,
      toEncodableProvider,
      toEncodable,
      entityHandlerProvider,
      entityCache);

  return jsonCodec.toJson(o, autoResetEntityCache: autoResetEntityCache);
}