ncmb 0.1.0

  • Readme
  • Changelog
  • Installing
  • 62

NCMB for Dart w/ Flutter #

Dart and Flutter library for Nifcloud mobile backend(NCMB).

Usage #

Init #

import 'package:ncmb/ncmb.dart';
NCMB ncmb = new NCMB('YOUR_APPLICATION_KEY', 'YOUR_CLIENT_KEY');

DataStore #

Create data

NCMBObject item = ncmb.Object('Item')
  ..set('msg', 'Hello World')
  ..set('array', ['a', 'b'])
  ..set('int', 1)
  ..set('name', 'Atsushi');
await item.save();
debugPrint(item.get('objectId'));

Update data

await item.set('name', 'goofmint');
await item.save();

Delete data

await item.destroy();

Retribe data

NCMBQuery query = ncmb.Query('Item');

// All data
var items = await query.fetchAll();
print(items[0].get('msg'));

// First data
var item2 = await query.fetch();
print(item2.get('msg'));

// Query (Equal)
query.equalTo('objectId', item.get('objectId'));
var item3 = await query.fetch();
print(item3.get('objectId'));

query.clear();
query
  ..notEqualTo('array', ['a', 'b', 'c'])
  ..limit(2)
  ..lessThan('int', 4);
items = await query.fetchAll();
print(items.length);

ACL

var acl = NCMBAcl();
acl
  ..setPublicReadAccess(true)
  ..setPublicWriteAccess(false)
  ..setRoleWriteAccess('Admin', true)
  ..setUserWriteAccess('aaaaa', true);
item3.set('acl', acl);

Special type

items[0]
  // Class of Datastore
  ..set('item', items[1])
  // DateTime
  ..set('time', DateTime.now())
  // Geo location
  ..set('geo', NCMBGeoPoint(35.658611, 139.745556));

User #

Register

var userName = 'aaa';
var password = 'bbb';
var user = await ncmb.User.signUpByAccount(userName, password);

Login #

user = await ncmb.User.login(userName, password);

Logout #

user.logout();

LICENSE #

MIT.

CHANGELOG #

0.0.1 #

Init.

  • Supporting save data to datastore.

0.0.2 #

Add example folder.

0.0.3 #

Add description to pubspec.yaml.

0.0.4 #

Update description. Maintenance code.

0.0.5 #

Support updating and deleting method at NCMBObject.

0.0.6 #

Support Retribing data.

0.0.7 #

Support Acl.

0.0.8 #

Support GeoPoint, DateTime and Class of DataStore.

0.0.9 #

Supprt user login and logout.

0.1.0 #

Support push notification.

Use this package as a library

1. Depend on it

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


dependencies:
  ncmb: ^0.1.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:ncmb/ncmb.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
28
Health:
Code health derived from static analysis. [more]
92
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
62
Learn more about scoring.

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

  • Dart: 2.8.1
  • pana: 0.13.8-dev

Health suggestions

Fix lib/src/object.dart. (-1.99 points)

Analysis of lib/src/object.dart reported 4 hints:

line 16 col 19: Unnecessary new keyword.

line 30 col 23: Unnecessary new keyword.

line 34 col 23: Unnecessary new keyword.

line 45 col 21: Unnecessary new keyword.

Fix lib/src/signature.dart. (-1.99 points)

Analysis of lib/src/signature.dart reported 4 hints:

line 28 col 9: Use contains instead of indexOf

line 34 col 7: DO use curly braces for all flow control structures.

line 46 col 26: Use isEmpty instead of length

line 69 col 17: Unnecessary new keyword.

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

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

line 20 col 12: Unnecessary new keyword.

line 24 col 12: Unnecessary new keyword.

line 28 col 12: Unnecessary new keyword.

Fix additional 7 files with analysis or formatting issues. (-3 points)

Additional issues in the following files:

  • lib/src/query.dart (2 hints)
  • lib/src/request.dart (2 hints)
  • lib/src/user.dart (2 hints)
  • lib/ncmb.dart (Run dartfmt to format lib/ncmb.dart.)
  • lib/src/acl.dart (Run dartfmt to format lib/src/acl.dart.)
  • lib/src/geopoint.dart (Run dartfmt to format lib/src/geopoint.dart.)
  • lib/src/installation.dart (Run dartfmt to format lib/src/installation.dart.)

Maintenance suggestions

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and ncmb.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
crypto ^2.1.3 2.1.4
http ^0.12.0+4 0.12.1
intl ^0.16.1 0.16.1
notification_reactor ^0.0.3+1 0.0.3+1
package_info ^0.4.0+13 0.4.0+18
plain_notification_token ^0.0.1 0.0.1
Transitive dependencies
charcode 1.1.3
collection 1.14.12
convert 2.1.1
flutter 0.0.0
http_parser 3.1.4
meta 1.1.8
path 1.7.0
pedantic 1.9.0
platform 2.2.1
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
test ^1.3.4