dictapi 0.1.2

  • README.md
  • Installing
  • Versions
  • 29


This package provides APIs to communicate with DICT servers.

From server-side applications it's possible to communicate directly with DICT servers via a dart:io socket, but it's also possible to use XHR to receive translations from a client-side application via the included HTTP server.

Because of the HTTP interface provided by this package you are not required to use dart. Any programming language which allows you to create HTTP requests and parse the JSON responses can be used.


Simply add the dictapi package as a dependency to the pubspec.yaml file of your application and run the pub get command.

  dictapi: ^0.1.2

If you only want to set up the HTTP server, you can skip the step above and activate the dictapi package instead.

pub global activate dictapi



If your code runs in the dart virtual machine, add the following import directive:

import 'package:dictapi/vm.dart';

Then you can connect to the DICT server using the DictConnection.connect method. The first argument is an URI pointing to the DICT server. The method returns a future which will complete with the instance of DictConnection once a connection has been established. If the optional named clientInfo argument is passed, the CLIENT command will be send first.

var uri = Uri.parse('dict://example.com:2628');
var dict = await DictConnection.connect(uri, clientInfo: 'My Dictionary');


If your code runs in the browser, add the following import directive:

import 'package:dictapi/web.dart';

Then create an instance of the DictXhr class and pass the base URI of the HTTP server to the constructor.

var uri = Uri.parse('http://example.com:8080');
var dict = new DictXhr(uri);

Common API

The DictConnection and DictXhr classes both implement the DictApi interface. The components of your application which work independently of the target platform can import the following library

import 'package:dictapi/dictapi.dart';

to communicate with DICT servers.

HTTP interface

To run the HTTP server change into your package directory and run the pub run dictapi serve command. If you've activated the dictapi package, run the pub global run dictapi serve instead.

By default the HTTP server listens for incoming requests on port 8080 and connects to the local DICT server on port 2628. You can pass command line arguments to change this behavior. Type pub [global] run dictapi serve --help to see a list of all available options.

When open a browser and and navigate to localhost on the configured port, e.g. http://localhost:8080. The server should respond with a list of available routes.


DICT.dart is licensed under the MIT license agreement. See the LICENSE file for details.


0.1.2 / 2016-21-03

  • Uri encode words before XHR query.

0.1.1 / 2016-21-03

  • Fix home route.

0.1.0 / 2016-21-03

  • Initial version.

Use this package as a library

1. Depend on it

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

  dictapi: "^0.1.2"

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:dictapi/dictapi.dart';
Version Uploaded Documentation Archive
0.1.2 Jul 25, 2016 Go to the documentation of dictapi 0.1.2 Download dictapi 0.1.2 archive
0.1.1 Mar 21, 2016 Go to the documentation of dictapi 0.1.1 Download dictapi 0.1.1 archive
0.1.0 Mar 21, 2016 Go to the documentation of dictapi 0.1.0 Download dictapi 0.1.0 archive


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

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
91 / 100
Reflects how tidy and up-to-date the package is. [more]
9 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:dictapi/dictapi.dart.


  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 5 errors 3 hints.

    Strong-mode analysis of lib/src/web/xhr.dart failed with the following error:

    line: 36 col: 28
    The type 'Map' used in the 'for' loop must implement Iterable.

    Strong-mode analysis of lib/server.dart gave the following hint:

    line: 8 col: 25
    The library 'dart:core' doesn't export a member with the hidden name 'Resource'.

    Similar analysis of the following files failed:

    • lib/src/vm/connection.dart (hint)
  • Package is getting outdated.

    The package was released 99 weeks ago.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use dictapi.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.13.0 <2.0.0
args ^0.13.3 0.13.7 1.4.3
di ^3.3.7 3.3.10
path ^1.3.9 1.6.1
petitparser ^1.5.1 1.7.6
quiver ^0.21.4 0.21.4 0.29.0+1
redstone ^0.6.5 0.6.8
resource ^1.1.0 1.1.0 2.1.4
shelf ^0.6.5 0.6.8 0.7.3+1
Transitive dependencies
analyzer 0.27.2 0.32.1
ansicolor 0.0.9 0.1.0
async 1.13.3 2.0.7
barback 0.15.2+16
boolean_selector 1.0.3
charcode 1.1.1
cli_util 0.0.1+2 0.1.3
code_transformers 0.3.1 0.5.1+5
collection 1.14.10
convert 2.0.1
crypto 2.0.5
csslib 0.13.7+1 0.14.4
glob 1.1.5
grinder 0.8.0+3 0.8.2
html 0.12.2+2 0.13.3+1
http 0.11.3+16
http_multi_server 2.0.5
http_parser 3.1.2
http_server 0.9.7
io 0.3.2+1
js 0.6.1
logging 0.11.3+1
matcher 0.12.2+1 0.12.3
meta 1.1.5
mime 0.9.6+1
mockable_filesystem 0.0.3
multi_server_socket 1.0.1
node_preamble 1.4.2
package_config 0.1.5 1.0.3
package_resolver 1.0.3
plugin 0.1.0 0.2.0+2
pool 1.3.5
pub_semver 1.4.1
route_hierarchical 0.7.0
shelf_packages_handler 1.0.3
shelf_static 0.2.7+1
shelf_web_socket 0.2.2 0.2.2+2
source_map_stack_trace 1.1.4
source_maps 0.10.5
source_span 1.4.0
stack_trace 1.9.2
stream_channel 1.6.7+1
string_scanner 1.0.2
supports_color 0.1.1
term_glyph 1.0.0
test 0.12.37 1.0.0
typed_data 1.1.5
unscripted 0.6.2
utf 0.9.0+4
watcher 0.9.7+8
web_socket_channel 1.0.8
when 0.2.0
which 0.1.3
yaml 2.1.14