gopher 0.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new46

gopher.dart #

An implementation of the Gopher protocol in Dart.

Installation #

In your pubspec.yaml:

dependencies:
  gopher: ^1.0.0

Simple Server #

import 'package:gopher/gopher.dart';

main() async {
  var server = await GopherServer.bind('127.0.0.1', 7070);
  print('Listening at gopher://127.0.0.1:7070');
  await for (var request in server) {
    if (request.path == '/hello') {
      request.writeText('Hello, Gopher world!');
    } else {
      request.writeItem(
          GopherItemType.file, ['Hello', '/hello', '127.0.0.1', '7070']);
    }

    await request.close();
  }
}

0.0.0 #

  • First version (no unit tests).

example/main.dart

import 'package:gopher/gopher.dart';

main() async {
  var server = await GopherServer.bind('127.0.0.1', 7070);
  print('Listening at gopher://127.0.0.1:7070');
  await for (var request in server) {
    if (request.path == '/hello') {
      request.writeText('Hello, Gopher world!');
    } else {
      request.writeItem(
          GopherItemType.file, ['Hello', '/hello', '127.0.0.1', '7070']);
    }

    await request.close();
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  gopher: ^0.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:gopher/gopher.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
12
Health:
Code health derived from static analysis. [more]
72
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
46
Learn more about scoring.

We analyzed this package on Oct 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

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

Health issues and suggestions

Fix lib/src/transformer.dart. (-25 points)

Analysis of lib/src/transformer.dart failed with 1 error:

line 14 col 39: The argument type 'Utf8Decoder' can't be assigned to the parameter type 'StreamTransformer<Uint8List, dynamic>'.

Document public APIs. (-1 points)

37 out of 37 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/server.dart. (-2.48 points)

Analysis of lib/src/server.dart reported 5 hints:

line 30 col 19: Use = to separate a named parameter from its default value.

line 31 col 18: Use = to separate a named parameter from its default value.

line 32 col 36: Use = to separate a named parameter from its default value.

line 33 col 36: Use = to separate a named parameter from its default value.

line 35 col 18: Use = to separate a named parameter from its default value.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
async ^2.0.0 2.4.0
charcode ^1.0.0 1.1.2
Transitive dependencies
collection 1.14.12
Dev dependencies
pedantic ^1.0.0
test ^1.0.0