parse_server_dart 0.0.5

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new54

parse_server_dart

A Parse Server library for Dart developers.

The original one seems not working and abandoned.

Usage

These seems work, still needs test and tweak

  • Users
    • signUp
    • login
    • user query
  • Basic Query
    • query all
  • Objects
    • creation

A simple usage example can be found in the 'example' directory with almost all working functions.

TODO:

  • A lot ......

Changelog

0.0.1

  • Initial version, created by Stagehand

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:math';
import 'package:parse_server_dart/parse_server_dart.dart';
import 'const.dart';

void main() => runApp(new MyApp());

var rndSeed = new Random();

String randomWord(){
  const wordList = ['now','is','come','time','for','all','good','this','Jack','not'];
  return wordList[rndSeed.nextInt(wordList.length-1)];
}

String randomString(int wordCount){
  var res = [];
  for(int i=0;i<wordCount;i++){
    res.add(randomWord());
  }
  var r = res.join(' ');
  var num = rndSeed.nextInt(100);
  return "$r $num";
}

void addObject() {
    var article = parse.object("Article");
    article.set('name',randomString(2));
    article.set('keyword',randomString(3));  
    article.set('desc',randomString(5));
    article.set('content',randomString(10));
    article.set('author',parse.user());
    article.save();
}


Parse parse = new Parse(new Credentials(Const.PARSE_APPID), Const.PARSE_SERVER_URL);

class MyApp extends StatelessWidget{
  @override Widget build(BuildContext context){
    return new MaterialApp(
      title:'Parse Demo',
      home: new ParseList()
    );
  }
}

class ParseList extends StatefulWidget {
  @override createState(){
    print("loading");
    var state = ParseListState();
    state.loadObjects();
    return state;
  }
}

class ParseListState extends State<ParseList>{
  List objList = [];

  Future<List> getObjects() async{
    var q = parse.query("Article");
    return  q.findObjects();
  }

  loadObjects(){
    getObjects().then((list){
      setState((){
        objList = list;
      });
    });
  }

  signUp(){
    var name = randomWord();
    var password = 'nopass';
    parse.user().signUp({
      'username':name,
      'password':password
    }).then((res){
      print("signup done as: $name");
      print("res: $res");
    });
  }

  login(){
    parse.user().queryAll().then((users){
      for (var user in users) {
        var name = user['username'];
        print("user: $name");
      }
      parse.user().set('username',users[0]['username']);
      parse.user().set('password','nopass');
      parse.user().login().then((res){
        print("login as first user: $res");
      });
    });
  }


  @override Widget build(BuildContext context){
    login();
    return new Scaffold(
      appBar: new AppBar(
        title:new Text('Parse Demo App'),
        actions: <Widget>[
          new IconButton(
            icon: new Icon(Icons.add),
            tooltip: 'Add Object',
            onPressed:()=>addObject()
          ),
          new IconButton(
            icon: new Icon(Icons.refresh),
            tooltip: 'Reload',
            onPressed: ()=>loadObjects(),
          ),
          new IconButton(
            icon: new Icon(Icons.verified_user),
            tooltip: 'Sign-up new User',
            onPressed: ()=>signUp()
          )
        ]
      ),
      body:new Center(child:ListView.builder(
        padding: new EdgeInsets.all(8.0),
        itemExtent: 40.0,
        itemBuilder: (BuildContext context, int index){
          var val = objList[index]['name'];
          var id = index+1;
          return new Text("$id:$val");
        },
        itemCount: objList.length
      ))
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  parse_server_dart: ^0.0.5

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support 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:parse_server_dart/parse_server_dart.dart';
  
Version Uploaded Documentation Archive
0.0.5 Oct 11, 2018 Go to the documentation of parse_server_dart 0.0.5 Download parse_server_dart 0.0.5 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
21
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
54
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.4
  • Flutter: 0.9.5

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/src/parse_base.dart. (-1.49 points)

Analysis of lib/src/parse_base.dart reported 3 hints:

line 16 col 8: The method '_handleResponse' isn't used.

line 36 col 15: The value of the field '_parseObject' isn't used.

line 38 col 13: The value of the field '_liveQuery' isn't used.

Format lib/src/credentials.dart.

Run flutter format to format lib/src/credentials.dart.

Format lib/src/parse_http_client.dart.

Run flutter format to format lib/src/parse_http_client.dart.

Fix additional 7 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/parse_livequery.dart (Run flutter format to format lib/src/parse_livequery.dart.)
  • lib/src/parse_object.dart (Run flutter format to format lib/src/parse_object.dart.)
  • lib/src/parse_user.dart (Run flutter format to format lib/src/parse_user.dart.)
  • lib/src/queries/parse_query.dart (Run flutter format to format lib/src/queries/parse_query.dart.)
  • lib/src/queries/parse_query_constants.dart (Run flutter format to format lib/src/queries/parse_query_constants.dart.)
  • lib/src/queries/parse_query_controller.dart (Run flutter format to format lib/src/queries/parse_query_controller.dart.)
  • lib/src/queries/parse_query_state.dart (Run flutter format to format lib/src/queries/parse_query_state.dart.)

Maintenance suggestions

The description is too short. (-20 points)

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-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means 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-dev.68.0 <3.0.0
flutter 0.0.0
http ^0.11.3 0.11.3+17 0.12.0
json_annotation ^1.2.0 1.2.0
path ^1.4.1 1.6.2
web_socket_channel ^1.0.6 1.0.9
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
convert 2.0.2
crypto 2.0.6
http_parser 3.1.3
meta 1.1.6
sky_engine 0.0.99
source_span 1.4.1
stream_channel 1.6.8
string_scanner 1.0.4
typed_data 1.1.6
vector_math 2.0.8