Skip to content

Commit

Permalink
refactor: add typedef
Browse files Browse the repository at this point in the history
  • Loading branch information
alestiago committed Oct 3, 2023
1 parent 349cc04 commit 3ff0d26
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/src/pub_license/pub_license.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,23 @@ class PubLicenseException implements Exception {
final String message;
}

/// The function signature for parsing HTML documents.
@visibleForTesting
typedef HtmlDocumentParse = html_dom.Document Function(
dynamic input, {
String? encoding,
bool generateSpans,
String? sourceUrl,
});

/// {@template pub_license}
/// Enables checking pub.dev's hosted packages license.
/// {@endtemplate}
class PubLicense {
/// {@macro pub_license}
PubLicense({
@visibleForTesting http.Client? client,
@visibleForTesting
html_dom.Document Function(
dynamic input, {
String? encoding,
bool generateSpans,
String? sourceUrl,
})? parse,
@visibleForTesting HtmlDocumentParse? parse,
}) : _client = client ?? http.Client(),
_parse = parse ?? html_parser.parse;

Expand Down

0 comments on commit 3ff0d26

Please sign in to comment.