Skip to content

Commit 1409ef6

Browse files
committed
📝 Update README and fix error message
1 parent a55f22e commit 1409ef6

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public_suffix is a dart library for identifying the public suffixes (or TLDs), r
1010
- Identify suffix, root domain, registrable domain (root + suffix) and subdomain from URLs.
1111
- Provide your own list of suffix rules to keep up to date with the rules you need.
1212
- Get results from matching with only ICANN/IANA rules or also include private ones.
13-
- For example, a private rule can see the full `github.io` as suffix while ICANN only recognises the `io` part.
13+
- For example, a private rule can see the full `github.io` as suffix while ICANN only recognises the `io` part.
1414
- Parse punycode encoded URLs and get both encoded and decoded results.
1515
- Check if URLs are subdomains, have valid domain parts, or end with known suffixes.
1616

@@ -32,22 +32,21 @@ public_suffix is a dart library for identifying the public suffixes (or TLDs), r
3232
import 'package:public_suffix/public_suffix.dart';
3333
3434
main() {
35-
// Load a list of suffix rules from publicsuffix.org.
35+
// Load a list of suffix rules.
3636
var suffixListString = 'load the list into this string';
3737
DefaultSuffixRules.initFromString(suffixListString);
38-
38+
3939
// Parse a URL.
40-
var parsedUrl =
41-
PublicSuffix.fromString('https://www.komposten.github.io');
42-
40+
var parsedUrl = PublicSuffix(urlString: 'https://www.komposten.github.io');
41+
4342
// Obtain information using the many getters, for example:
4443
print(parsedUrl.suffix); // github.io
4544
print(parsedUrl.root); // komposten
4645
print(parsedUrl.domain); // komposten.github.io
4746
print(parsedUrl.icannDomain); // github.io
4847
4948
// public_suffix also supports punycoded URLs:
50-
parsedUrl = PublicSuffix.fromString('https://www.xn--6qq79v.cn');
49+
parsedUrl = PublicSuffix(urlString: 'https://www.xn--6qq79v.cn');
5150
print(parsedUrl.domain); // xn--6qq79v.cn
5251
print(parsedUrl.punyDecoded.domain); // 你好.cn
5352
}
@@ -112,7 +111,7 @@ Just like before, there are two ways of doing this:
112111
}
113112
```
114113

115-
**Note:** Don't overload publicsuffix.org's servers by repeatedly retrieving the suffix list from them. Cache a copy somewhere instead, and update that copy only when the master copy is updated.
114+
**Note:** Don't overload publicsuffix.org's servers by repeatedly retrieving the suffix list from them. Cache a copy somewhere instead, and update that copy when the master copy is updated.
116115

117116
## Utility functions
118117
Several utility functions can be found in the `DomainUtils` class (imported from `public_suffix.dart`). These currently include:

lib/src/default_suffix_rules.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class DefaultSuffixRules {
2828
if (hasInitialised()) {
2929
return rules!;
3030
} else {
31-
throw StateError('PublicSuffixList has not been initialised!');
31+
throw StateError('DefaultSuffixRules has not been initialised!');
3232
}
3333
}
3434

0 commit comments

Comments
 (0)