Showing
2 changed files
with
3 additions
and
0 deletions
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | - Implement PdfPageLabels | 7 | - Implement PdfPageLabels |
| 8 | - Typo: rename "litteral" with "literal" | 8 | - Typo: rename "litteral" with "literal" |
| 9 | - Fix tabs and other spaces placeholder | 9 | - Fix tabs and other spaces placeholder |
| 10 | +- Prevent modifying the document once saved | ||
| 10 | 11 | ||
| 11 | ## 3.7.4 | 12 | ## 3.7.4 |
| 12 | 13 |
| @@ -114,11 +114,13 @@ class Document { | @@ -114,11 +114,13 @@ class Document { | ||
| 114 | bool _paint = false; | 114 | bool _paint = false; |
| 115 | 115 | ||
| 116 | void addPage(Page page, {int? index}) { | 116 | void addPage(Page page, {int? index}) { |
| 117 | + assert(!_paint, 'The document has already been saved.'); | ||
| 117 | page.generate(this, index: index); | 118 | page.generate(this, index: index); |
| 118 | _pages.add(page); | 119 | _pages.add(page); |
| 119 | } | 120 | } |
| 120 | 121 | ||
| 121 | void editPage(int index, Page page) { | 122 | void editPage(int index, Page page) { |
| 123 | + assert(!_paint, 'The document has already been saved.'); | ||
| 122 | page.generate(this, index: index, insert: false); | 124 | page.generate(this, index: index, insert: false); |
| 123 | _pages.add(page); | 125 | _pages.add(page); |
| 124 | } | 126 | } |
-
Please register or login to post a comment