webart_resource 0.0.1

  • README.md
  • Example
  • Installing
  • Versions
  • 0

webart_resource #

A simple way to reorganize resources in your web application.

STATUS: Alpha Version! #

It just a easy work for now, please don't use it in production if you do not know what you are doing.

STATUS: Offer Dart 1.x support only #

webart still only offer dart 1.x support, so this plugin could not run on dart 2 strong mode.
But it looks like useless that upgrade to dart 2 if you are using dart in backend.

How to use #

  1. Include it in your pubspec.yaml
  webart: ^0.2.6
  webart_resource: ^0.0.1
  1. Import it in your code
import "package:webart_resource/webart_resource.dart";
  1. Define some resources
class MyResource implements Resource<Map,Map>{ ... }
  1. Put them in your config
var app = new Application(new Config({
    'routes':{ ... },
    'resources': [
        new MyResource(),
        new OtherResource()
  1. Use ResourcePlugin
app.use(new ResourcePlugin());

There is a example in 'example/example.dart' that has more infomation.

Documents #

Aren't finished yet.

License #

Copyright 2018 thisLight

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


Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


import 'dart:async';
import 'package:webart/webart.dart';
import 'package:webart_resource/webart_resource.dart';

class ExampleResource implements RemoveableResource<Map,Map>{
    String address = "example";
    Map<String,Map<String,dynamic>> memories;

        memories = {};

  Future<Map> get(Map entry) async {
      String key = entry['key'];
    var res = memories[key];
    if (res == null) throw new ResourceNotFound();
    return res;

  Future<dynamic> remove(Map entry) async {
    String key = entry['key'];

  Future<dynamic> save(Map entry, Map res) async {
    String key = entry['key'];
    memories[key] = res;

main() async{
    var app = new Application(new Config({
        'routes': {},
        'resources': [
            new ExampleResource()
    app.use(new ResourcePlugin());
    await app.start('', 8089);

Use this package as a library

1. Depend on it

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

  webart_resource: ^0.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

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

3. Import it

Now in your Dart code, you can use:

import 'package:webart_resource/webart_resource.dart';
Version Uploaded Documentation Archive
0.0.1 Aug 19, 2018 Go to the documentation of webart_resource 0.0.1 Download webart_resource 0.0.1 archive
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.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0