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.
dependencies: dictapi: ^0.1.2
If you only want to set up the HTTP server, you can skip the step above and
dictapi package instead.
pub global activate dictapi
If your code runs in the dart virtual machine, add the following import directive:
Then you can connect to the DICT server using the
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
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:
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);
DictXhr classes both implement the
interface. The components of your application which work independently of
the target platform can import the following library
to communicate with DICT servers.
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
pub global run dictapi serve instead.
By default the HTTP server listens for incoming requests on port
connects to the local DICT server on port
2628. You can pass command
line arguments to change this behavior.
pub [global] run dictapi serve --help to see a list of all available
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
DICT.dart is licensed under the MIT license agreement. See the LICENSE file for details.
Add this to your package's pubspec.yaml file:
dependencies: dictapi: "^0.1.2"
You can install packages from the command line:
$ pub get
$ flutter packages get
Alternatively, your editor might support
pub get or
flutter packages get.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|0.1.2||Jul 25, 2016|
|0.1.1||Mar 21, 2016|
|0.1.0||Mar 21, 2016|
We analyzed this package on Jun 19, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Detected platforms: Flutter, web, other
No platform restriction found in primary library
Fix analysis and formatting issues.
Analysis or formatting checks reported 5 errors 3 hints.
Strong-mode analysis of
lib/src/web/xhr.dartfailed 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.dartgave 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:
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:
example.dartor you could also use
|Dart SDK||>=1.13.0 <2.0.0|