dart_lcs_client 1.0.7

A dart client library to make working with lcs ludicrously splendid

pub package

Used Here: (https://github.com/HackRU/OneAppFlutter)

more info soon!

example/main.dart

import 'dart:io' show Platform;

import 'package:dart_lcs_client/dart_lcs_client.dart';

var env = Platform.environment;
var _lcsUrl = 'REPLACE_WITH_LCS_URL';
var _miscUrl = 'REPLACE_WITH_MISC_URL';

void testHelpResources() async {
  var result = await helpResources(_miscUrl);
  print("************* testHelpResources **********");
  result.forEach((resource) {
    print(resource);
  });
}

void testSitemap() async {
  var result = await sitemap(_miscUrl);
  print("************* testSitemap **********");
  print(result);
}

void testEvents() async {
  var result = await events(_miscUrl);
  print("************* testEvents **********");
  print(result);
}

void testLabelUrl() async {
  var result = await labelUrl(_miscUrl);
  print("************* testLabelUrl **********");
  print(result);
}

void testExpired() {
  print("************* testExpired cred **********");
  var l = LcsCredential("test", "account", DateTime.now());
  assert(l.isExpired());
}

void testLogin() async {
  try {
    await login("bogus", "login", _lcsUrl);
    print("************* failed to catch bad login *************");
  } on LcsLoginFailed catch (e) {
    print("************* caught failed login *************");
  }
  var l = await login(env["LCS_USER"], env["LCS_PASSWORD"], _lcsUrl);
  assert(!l.isExpired());
}

void testPostLcsExpired() async {
  var cred = LcsCredential("Bogus", "Cred", DateTime.now());
  try {
    await postLcs(_lcsUrl, "/read", {}, cred);
    assert(false); // should have thrown CredentialExpired
  } on CredentialExpired catch (e) {
    print(" ************* succesfully caught expired credential *************");
  }
}

void testGetUser() async {
  var cred = await login(env["LCS_USER"], env["LCS_PASSWORD"], _lcsUrl);
  var user = await getUser(_lcsUrl, cred);
  print("************* test get user *************");
  print(user);
}

void testOtherUser() async {
  var cred = await login(env["LCS_USER"], env["LCS_PASSWORD"], _lcsUrl);
  var user = await getUser(_lcsUrl, cred, env["LCS_USER2"]);
  try {
    var baduser = await getUser(_lcsUrl, cred, "fail@email.com");
    assert(false);
  } on NoSuchUser catch (error) {
    print(
        "************* successfuly caught attempt to get nonexistent user *************");
  }
  print("************* test get a different user *************");
  print(user);
}

void testUpdateDayOf() async {
  var cred = await login(env["LCS_USER"], env["LCS_PASSWORD"], _lcsUrl);
  var user = await getUser(_lcsUrl, cred, env["LCS_USER2"]);
  await updateUserDayOf(_lcsUrl, cred, user,
      "fake_event${DateTime.now().millisecondsSinceEpoch}");
  var user2 = await getUser(_lcsUrl, cred, env["LCS_USER2"]);
  print("************* test update user day_of *************");
  print(user);
  print(user2);
}

void main() async {
  testHelpResources();
  testSitemap();
  testEvents();
  testLabelUrl();
  testExpired();
  testLogin();
  testPostLcsExpired();
  testGetUser();
  testOtherUser();
  testUpdateDayOf();
}

Use this package as a library

1. Depend on it

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


dependencies:
  dart_lcs_client: ^1.0.7

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support 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:dart_lcs_client/dart_lcs_client.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
52
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
18
Overall:
Weighted score of the above. [more]
59
Learn more about scoring.

We analyzed this package on Sep 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/src/hackru_service.dart. (-1 points)

Analysis of lib/src/hackru_service.dart reported 2 hints:

line 60 col 10: Await only futures.

line 65 col 10: Await only futures.

Format lib/dart_lcs_client.dart.

Run flutter format to format lib/dart_lcs_client.dart.

Format lib/src/models.dart.

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

Maintenance issues and suggestions

Support latest dependencies. (-50 points)

The version constraint in pubspec.yaml does not support the latest published versions for 5 dependencies (bloc, equatable, flutter_bloc, http, intl).

Provide a file named CHANGELOG.md. (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

The package description is too short. (-12 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0-dev.68.0 <3.0.0
bloc ^0.14.4 0.14.4 0.15.0
equatable ^0.4.0 0.4.0 0.5.1
flutter 0.0.0
flutter_bloc ^0.20.1 0.20.1 0.21.0
flutter_linkify ^2.1.0 2.1.0
http ^0.11.3+16 0.11.3+17 0.12.0+2
http_middleware ^1.0.0 1.0.0
intl ^0.15.8 0.15.8 0.16.0
meta ^1.1.6 1.1.7
path_provider ^1.2.0 1.3.0
url_launcher ^5.1.2 5.1.3
Transitive dependencies
async 2.3.0
charcode 1.1.2
collection 1.14.11 1.14.12
http_parser 3.1.3
linkify 1.0.1
path 1.6.4
platform 2.2.1
provider 3.1.0
rxdart 0.22.2
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test