toText method

String toText({
  1. TextWriterFormat<FeatureContent> format = GeoJSON.feature,
  2. int? decimals,
  3. CoordRefSys? crs,
  4. Map<String, dynamic>? options,
})

The string representation of this feature object, with format applied.

When format is not given, then the feature format of GeoJSON is used as a default.

Use decimals to set a number of decimals (not applied if no decimals).

Use crs to give hints (like axis order, and whether x and y must be swapped when writing) about coordinate reference system in text output.

Other format or encoder implementation specific options can be set by options.

Implementation

String toText({
  TextWriterFormat<FeatureContent> format = GeoJSON.feature,
  int? decimals,
  CoordRefSys? crs,
  Map<String, dynamic>? options,
}) {
  final encoder =
      format.encoder(decimals: decimals, crs: crs, options: options);
  writeTo(encoder.writer);
  return encoder.toText();
}