link_checker 2.0.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 58

link_checker

Can find links and check if they're dead in almost any file.

Are you tired of finding dead links in projects from READMEs to large websites? Yes, yes you are. link_checker allows you to test for dead links, whether it be a single link, a file, or an entire project, all with a single line! It can check most types of file, such as Java, Dart, and Markdown. link_checker can efficiently search your entire project by allowing you to blacklist directories, blacklist links using regex, etc.

import 'package:link_checker/link_checker.dart';
import 'package:test/test.dart';

void main() {
  test('this project for dead links', () {
    expect(
        getBadLinksInDirectory(blacklistedDirectories: [
          BlacklistedDirectory('test'),
          BlacklistedDirectory('example')
        ], blacklistedLinks: [
          'http://schemas.android.com'
        ]),
        emitsDone);
  }, timeout: Timeout.none);
}

You'll probably want the CI to run every twenty-four hours, since broken links aren't created from just your own commits, but external web pages being deleted as well.

v2.0.1

  • Fixed bug in link parsing where plain protocols (example: just https instead of https://google.com) were considered links.

v2.0.0

  • getBadLinksInDirectory
    • Renamed {String directory} to {String path}.
    • Renamed {List<String> blacklistedFiles} to {List<String> blacklistedFilePaths}.
    • Added {List<String> blacklistedLinks}.
    • Added {List<RegExp> blacklistedLinksRegexes}.
  • getLinksInDirectory
    • Renamed {String directory} to {String path}.
    • Renamed {List<String> blacklistedFiles} to {List<String> blacklistedFilePaths}.
    • Added {List<String> blacklistedLinks}.
    • Added {List<RegExp> blacklistedLinksRegexes}.
  • getBadLinksInFile
    • Added {List<String> blacklistedLinks}.
    • Added {List<RegExp> blacklistedLinksRegexes}.
  • getLinksInFile
    • Changed return type from Stream<String> to Future<List<String>>.
    • Added {List<String> blacklistedLinks}.
    • Added {List<RegExp> blacklistedLinksRegexes}.
  • Added String parseUrl(String url).
  • Added bool isGoodStatusCode(int statusCode).
  • Improved link parsing by taking delimiters into account. For example, a file containing the link https://google.com as var link = 'https://google.com'; will now be parsed as https://google.com instead of https://google.com'.

v1.1.1

  • Lowered the minimum SDK version from 2.0.0-dev.65.0 to 2.0.0-dev.56.0.

v1.1.0

  • getBadLinksInDirectory
    • Added {bool followLinks = true}.
  • BlacklistedDirectory
    • Added {bool followLinks = true} to default constructor.
  • getLinksInDirectory
    • Added {bool followLinks = true}.

v1.0.0

  • Released the first version.

example/main.dart

import 'package:link_checker/link_checker.dart';

/*
This will print https://github.com/neelkamath/nonexistent-repository and
http://lakdjflakfasldfkjadlkfj.io since they're bad links, but not
https://google.com since it's a good link.
 */
void main() async {
  await for (final link in getBadLinksInFile('example/main.dart')) {
    print(link);
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  link_checker: ^2.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:link_checker/link_checker.dart';
  
Version Uploaded Documentation Archive
2.0.1 Aug 19, 2018 Go to the documentation of link_checker 2.0.1 Download link_checker 2.0.1 archive
2.0.0 Aug 11, 2018 Go to the documentation of link_checker 2.0.0 Download link_checker 2.0.0 archive
1.1.1 Jul 28, 2018 Go to the documentation of link_checker 1.1.1 Download link_checker 1.1.1 archive
1.1.0 Jul 27, 2018 Go to the documentation of link_checker 1.1.0 Download link_checker 1.1.0 archive
1.0.0 Jul 26, 2018 Go to the documentation of link_checker 1.0.0 Download link_checker 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
16
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
58
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, other

Primary library: package:link_checker/link_checker.dart with components: io.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.56.0 <3.0.0
markdown ^2.0.2 2.0.2
Transitive dependencies
args 1.5.1
charcode 1.1.2
Dev dependencies
test ^1.3.0