This repository was archived by the owner on May 27, 2024. It is now read-only.
This repository was archived by the owner on May 27, 2024. It is now read-only.
Properly document nullable members or make them not nullable. #40
Open
Description
Some classes in this library have nullable type member variables, and it is not apparent why.
For example...
/// A line
class GeoJsonLine {
/// Default constructor
GeoJsonLine({this.geoSerie, this.name});
/// The geometry data
GeoSerie? geoSerie;
/// The name of the line
String? name;
/// Serialize to a geojson feature string
String? serializeFeature(Map<String, dynamic>? properties) =>
geoSerie?.toGeoJsonFeatureString(properties);
}
Why is GeoSerie nullable? Does a GeoJsonLine make sense without a GeoSerie? Under what circumstances would this be null? Should this even be null?
If this member is never null, it should be typed as such. Libraries should try to never expose nullable types unless there is very good reason.
Metadata
Metadata
Assignees
Labels
No labels