Skip to content

Commit

Permalink
Update listener handling flutter/flutter#32936
Browse files Browse the repository at this point in the history
  • Loading branch information
DavBfr committed Jul 9, 2019
1 parent 4c5c62a commit c30ba0d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 45 deletions.
81 changes: 42 additions & 39 deletions printing/CHANGELOG.md
@@ -1,101 +1,104 @@
# Changelog

## 2.1.0

* Add html to pdf platform conversion
- Add html to pdf platform conversion
- Fix issue with flutter 1.6.2+

## 2.0.4

* Update Readme
- Update Readme

## 2.0.3

* Add file save and view to example application
* Convert print screen example to Widgets
* Deprecate the document argument in Printing.sharePdf()
- Add file save and view to example application
- Convert print screen example to Widgets
- Deprecate the document argument in Printing.sharePdf()

## 2.0.2

* Fix example application
- Fix example application

## 2.0.1

* Fix Replace FlutterErrorDetails to be compatible with Dart 2.3.0
- Fix Replace FlutterErrorDetails to be compatible with Dart 2.3.0

## 2.0.0

* Breaking change: Switch libraries to AndroidX
* Add Page information to PdfDoc object
- Breaking change: Switch libraries to AndroidX
- Add Page information to PdfDoc object

## 1.3.5

* Restore compatibility with Flutter 1.0.0
* Update code to Dart 2.1.0
* Depends on pdf 1.3.3
- Restore compatibility with Flutter 1.0.0
- Update code to Dart 2.1.0
- Depends on pdf 1.3.3

## 1.3.4

* Fix iOS build with Swift
* Add installation instructions in the Readme
* Follow Flutter debug painting settings
- Fix iOS build with Swift
- Add installation instructions in the Readme
- Follow Flutter debug painting settings

## 1.3.3

* Fix dart lint warnings
* Add documentation
* Add a filename parameter for sharing
* Convert Objective-C code to Swift
* Update Readme
- Fix dart lint warnings
- Add documentation
- Add a filename parameter for sharing
- Convert Objective-C code to Swift
- Update Readme

## 1.3.2

* Fix iOS printing issues
- Fix iOS printing issues

## 1.3.1

* Fix pana linting notices
- Fix pana linting notices

## 1.3.0

* Add a Flutter like widget system
- Add a Flutter like widget system

## 1.2.0

* Fix compileSdkVersion to match appcompat
* Change license to Apache 2.0
* Implement asynchronous printing driven by the OS
- Fix compileSdkVersion to match appcompat
- Change license to Apache 2.0
- Implement asynchronous printing driven by the OS

## 1.1.0

* Rename classes to satisfy Dart conventions
* Remove useless new and const keywords
* Changed appcompat dependency to 26.1.0
- Rename classes to satisfy Dart conventions
- Remove useless new and const keywords
- Changed appcompat dependency to 26.1.0

## 1.0.6

* Add screenshot example
- Add screenshot example

## 1.0.5

* Fix printing from pdf document
- Fix printing from pdf document

## 1.0.4

* Update example for pdf 1.0.5
* Add Contributing
- Update example for pdf 1.0.5
- Add Contributing

## 1.0.3

* Update source formatting
* Update README
- Update source formatting
- Update README

## 1.0.2

* Add License file
* Updated homepage
- Add License file
- Updated homepage

## 1.0.1

* Fixed sdk version
- Fixed sdk version

## 1.0.0

* Initial release.
- Initial release.
11 changes: 5 additions & 6 deletions printing/lib/src/asset_utils.dart
Expand Up @@ -40,16 +40,15 @@ Future<PdfImage> pdfImageFromImageProvider(
final ImageStream stream =
image.resolve(configuration ?? ImageConfiguration.empty);

Future<void> listener(ImageInfo image, bool sync) async {
ImageStreamListener listener;
listener = ImageStreamListener((ImageInfo image, bool sync) async {
final PdfImage result =
await pdfImageFromImage(pdf: pdf, image: image.image);
if (!completer.isCompleted) {
completer.complete(result);
}
stream.removeListener(listener);
}

void errorListener(dynamic exception, StackTrace stackTrace) {
}, onError: (dynamic exception, StackTrace stackTrace) {
if (!completer.isCompleted) {
completer.complete(null);
}
Expand All @@ -59,9 +58,9 @@ Future<PdfImage> pdfImageFromImageProvider(
// https://groups.google.com/forum/#!topic/flutter-announce/hp1RNIgej38
assert(false, 'image failed to load');
}
}
});

stream.addListener(listener, onError: errorListener);
stream.addListener(listener);
return completer.future;
}

Expand Down

0 comments on commit c30ba0d

Please sign in to comment.