@@ -143,18 +143,26 @@ class MapCamera {
143143 }) : _cameraSize = size,
144144 _pixelBounds = pixelBounds,
145145 _bounds = bounds,
146- _pixelOrigin = pixelOrigin;
146+ _pixelOrigin = pixelOrigin,
147+ assert (
148+ zoom.isFinite,
149+ 'Camera `zoom` must be finite (and usually positive).\n '
150+ '(This may occur if the map tried to fit to a zero-area bounds, such '
151+ 'as a bounds defined by only a single point.)' ,
152+ );
147153
148154 /// Initializes [MapCamera] from the given [options] and with the
149155 /// [nonRotatedSize] set to [kImpossibleSize] .
150156 MapCamera .initialCamera (MapOptions options)
151- : crs = options.crs,
152- minZoom = options.minZoom,
153- maxZoom = options.maxZoom,
154- center = options.initialCenter,
155- zoom = options.initialZoom,
156- rotation = options.initialRotation,
157- nonRotatedSize = kImpossibleSize;
157+ : this (
158+ crs: options.crs,
159+ minZoom: options.minZoom,
160+ maxZoom: options.maxZoom,
161+ center: options.initialCenter,
162+ zoom: options.initialZoom,
163+ rotation: options.initialRotation,
164+ nonRotatedSize: kImpossibleSize,
165+ );
158166
159167 /// Returns a new instance of [MapCamera] with the given [nonRotatedSize] .
160168 MapCamera withNonRotatedSize (Size nonRotatedSize) {
0 commit comments