sponge_client_dart 1.16.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 53


Sponge client for Dart. #

This is the Sponge Remote API client for Dart.

See example/example.dart.

For more information on Sponge see https://sponge.openksavi.org.

1.16.0 (2020-06-12) #

  • API change: The Sponge REST API has been renamed to the Sponge Remote API. The Sponge Remote API is intended to be JSON-RPC 2.0 compatible.
  • API change: Moved the readOnly flag from ProvidedMeta to DataType.
  • API change: Added features to the response header.
  • API change: Added ProvideActionArgsRequestBody.initial.
  • API change: Renamed ProvideActionArgsRequestBody.features to argFeatures.
  • API change: Added minValue and maxValue to DateTimeType.
  • API change: Introduced a SubAction typed feature for contextActions, createAction, readAction, updateAction, deleteAction and activateAction instead of string specifications.
  • API change: Renamed the 'this' keyword in a data type path to '@this'.
  • API change: Renamed the 'submit' keyword in an activation action name to '@submit'.
  • API change: Renamed SpongeUtils to SpongeClientUtils.
  • API change: Added new Remote API features: spongeVersion (instead of version) and apiVersion.
  • Added support for named action arguments (as a map) to the call Remote API method.
  • Added support for @index and @parent sub-action substitutions.
  • Added license and description to the Remote API features.
  • Added networkImage to the supported characteristic feature values.
  • Added support for GeoCrs and GeoWmsLayer.
  • Dependencies upgrade.

1.15.0 (2020-03-30) #

  • API change: Changed submittable type from bool to SubmittableMeta in the ProvidedMeta.
  • Added an activatable flag to an action.
  • Added features to the request header.
  • Added support for typed features and feature converters.
  • Added support for event features.
  • Added support for geographical map features.
  • The default REST API path is now empty. The previous value was sponge.json/v1.
  • Dependencies upgrade.

1.14.0+1 (2019-12-21) #

  • Added indicatedIndex to PageableList.
  • Code cleanup.
  • Dependencies upgrade.

1.14.0 (2019-12-20) #

  • API change: A payload in a request and a response has been moved to body.
  • API change: Renamed label to valueLabel and description to valueDescription in AnnotatedValue.
  • API change: Removed SpongeRestClient.submitActionArgs. Use provideActionArgs directly.
  • Added AnnotatedValue.typeLabel and AnnotatedValue.typeDescription.
  • Added ProvidedMeta.mode - a provided read mode: explicit (default), optional or implicit.
  • Added support for context action result substitution.
  • Added high level classes (e.g. ActionData, PageableList) in the data package. Currently marked as experimental.
  • Added support for a companion type in an object type.
  • Added support for the isActionActive REST operation.
  • Removed support for features in an action arguments provision result itself (ProvidedValue). Such features can be provided in an AnnotatedValue.
  • Removed experimental support for pageable value set and element value set.

1.13.0 (2019-10-30) #

  • Added support for submitting action arguments to the server.
  • Added support for features in action arguments provision.
  • Added the Features class that lists all predefined features.
  • API change: Renamed error codes.
  • Dependencies upgrade.

1.12.0 (2019-09-30) #

  • Improved RemoteEvent marshaling.
  • DynamicValue unwrapping in DataTypeUtils.
  • Added a return value in the DataTypeUtils.traverseValue method.
  • Dependencies upgrade.

1.11.0 (2019-07-11) #

  • API change: Base request and response properties have been moved to headers.
  • Added label and description to REST API send event.
  • Added a new property unique to the ListType.
  • Added support for the features REST operation.
  • Added support for element value set for provided list types.
  • Dependencies upgrade.

1.10.0 (2019-05-10) #

  • Added DataType.registeredType.
  • Added support for RecordType inheritance.
  • Added support for automatic use of auth tokens.
  • Added support for custom REST API operations.

1.9.0 (2019-04-15) #

  • Added a new type StreamType.
  • Dependencies upgrade.

1.8.0 (2019-03-04) #

  • API change: Action arguments and result metadata are now specified as data types. ArgMeta and ResultMeta classes have been removed.
  • API change: Renamed ArgProvidedMeta to ProvidedMeta, ArgProvidedValue to ProvidedValue and ProvidedMeta.depends to ProvidedMeta.dependencies.
  • API change: Removed AnnotatedType. Use DataType.withAnnotated() instead.
  • Added support for categories. Processors may be assigned to registered categories.
  • Added new types: DynamicType, TypeType, DateTimeType.
  • Added CategoryMeta.features.
  • Fixed the bug that caused an error when sending an empty body in the REST API request.

1.7.0 (2019-02-01) #

  • API change: Renamed displayName to label.
  • API change: Renamed ActionArgMeta to ArgMeta, ActionResultMeta to ResultMeta, ArgProvided to ArgProvidedMeta, ArgValue to ArgProvidedValue.
  • API change: A provided argument specification in now placed in the ArgProvidedMeta class, not directly in the ArgMeta as before.
  • API change: Removed LabeledValue and ArgProvidedValue.valueSetDisplayNames because of a new support for an annotated value set.

1.6.0 (2019-01-11) #

  • A new REST API operation actionArgs that fetches the provided action arguments from the server. There is a possibility to provide action argument values and possible value sets in the action configuration. It makes easier creating a generic UI for an action call that reads and presents the actual state of the entities that are to be changed by the action and its arguments.
  • API change: Removed ActionType because there is a more versatile feature of providing action argument values and value sets.
  • Added a context and listeners to the REST API client.
  • Added a new data type AnnotatedType.

1.5.1 (2018-11-14) #

  • Removed dart:io dependency.
  • Allowed non strict types in type converters.

1.5.0 (2018-11-14) #

  • The initial release, compatible with Sponge 1.5.x.


// Copyright 2018 The Sponge authors.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//      http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.

import 'package:sponge_client_dart/sponge_client_dart.dart';

void main() async {
  // Create a new client for an anonymous user.
  var client = SpongeClient(SpongeClientConfiguration('http://localhost:8888'));

  // Get the Sponge Remote API version.
  var version = await client.getVersion();
  print('Sponge Remote API version: $version.');

  // Get actions metadata.
  var actionsMeta = await client.getActions();
  print('Available action count: ${actionsMeta.length}.');

  // Call the action with arguments.
  String upperCaseText = await client.call('UpperCase', args: ['Text to upper case']);
  print('Upper case text: $upperCaseText.');

  // Send a new event to the Sponge engine.
  var eventId = await client.send('alarm',
      attributes: {'source': 'Dart client', 'message': 'Something happened'});
  print('Sent event id: $eventId.');

  // Create a new client for a named user.
  client = SpongeClient(
      ..username = 'john'
      ..password = 'password',

Use this package as a library

1. Depend on it

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

  sponge_client_dart: ^1.16.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:sponge_client_dart/sponge_client_dart.dart';
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]
Learn more about scoring.

We analyzed this package on Jul 14, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
collection ^1.14.12 1.14.13 1.15.0-nullsafety
equatable ^1.1.1 1.2.2
http ^0.12.1 0.12.1
intl ^0.16.1 0.16.1
logging ^0.11.4 0.11.4
meta ^1.1.8 1.2.2 1.3.0-nullsafety
quiver ^2.1.3 2.1.3
synchronized ^2.2.0 2.2.0+1
timezone ^0.5.7 0.5.7
Transitive dependencies
charcode 1.1.3
http_parser 3.1.4
matcher 0.12.9
path 1.7.0
source_span 1.7.0
stack_trace 1.9.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0 1.3.0-nullsafety
Dev dependencies
pedantic ^1.9.0 1.9.2
test ^1.14.3