David PHAM-VAN

Fix MultiPage.maxPages not checked with release builds

@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 ## 3.11.2 3 ## 3.11.2
4 4
5 - Add support for custom fonts in SVGs. [Tyler Denniston] 5 - Add support for custom fonts in SVGs. [Tyler Denniston]
  6 +- Fix MultiPage.maxPages not checked with release builds
6 7
7 ## 3.11.1 8 ## 3.11.1
8 9
@@ -254,11 +254,14 @@ class MultiPage extends Page { @@ -254,11 +254,14 @@ class MultiPage extends Page {
254 while (_index < children.length) { 254 while (_index < children.length) {
255 final child = children[_index]; 255 final child = children[_index];
256 256
257 - // Detect too big widgets  
258 - if (sameCount++ > maxPages) {  
259 - throw TooManyPagesException(  
260 - 'This widget created more than $maxPages pages. This may be an issue in the widget or the document. See https://pub.dev/documentation/pdf/latest/widgets/MultiPage-class.html');  
261 - } 257 + assert(() {
  258 + // Detect too big widgets
  259 + if (sameCount++ > maxPages) {
  260 + throw TooManyPagesException(
  261 + 'This widget created more than $maxPages pages. This may be an issue in the widget or the document. See https://pub.dev/documentation/pdf/latest/widgets/MultiPage-class.html');
  262 + }
  263 + return true;
  264 + }());
262 265
263 // Calculate available space of the current page 266 // Calculate available space of the current page
264 final freeSpace = (offsetStart == null) 267 final freeSpace = (offsetStart == null)