@@ -143,18 +143,26 @@ class MapCamera {
143
143
}) : _cameraSize = size,
144
144
_pixelBounds = pixelBounds,
145
145
_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
+ );
147
153
148
154
/// Initializes [MapCamera] from the given [options] and with the
149
155
/// [nonRotatedSize] set to [kImpossibleSize] .
150
156
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
+ );
158
166
159
167
/// Returns a new instance of [MapCamera] with the given [nonRotatedSize] .
160
168
MapCamera withNonRotatedSize (Size nonRotatedSize) {
0 commit comments