kinfolk 0.0.8

  • Readme
  • Changelog
  • Installing
  • 66

kinfolk #

A new Flutter package for integration with CUBA Platform based backend.

Awesome Flutter

Features #

  • Authorization via the Rest Api using your username and password
  • Storing and reusing Access Token
  • Compliance with the CUBA documentation for the REST API. (at the moment partial)

Installation #

in your pubspec.yaml add dependency

dependencies:
  flutter:
    sdk: flutter
  kinfolk: ^0.0.4

then run. packages get

Example #


/// initialize service
Kinfolk kinfolk = Kinfolk();

/// setting server url and security keys (identifier,secter)
kinfolk.initializeBaseVariables("http://localhost:8080/test", "client", "secret", Directory.current.path);

/// getting client (service with Access Token) in first time with login,password
oauth2.Client client = await kinfolk.getToken("admin", "admin");

///  getting single model
///  test_SomeService  -  service name 
///  getToDoList - method name
///  Types - enum
/// formMap - function converting Map<String, dynamic> map to your Model
ToDoList model =
    Kinfolk.getSingleModelRest(
      serviceName: "test_SomeService", 
      methodName: "getToDoList", 
      type: Types.services, 
      fromMap: (Map<String, dynamic> val)=> ToDoList.fromMap(val));

String body = """
    {
    "monday":"work",
     "sunday":"relax"
    }
""";

///  getting single model with request body
///  test_SomeService  -  service name 
///  getToDoList - method name
///  Types - enum
///  body - request body
/// formMap - function converting Map<String, dynamic> map to your Model
ToDoList model =
    Kinfolk.getSingleModelRest(
      serviceName: "test_SomeService", 
      methodName: "getToDoList", 
      type: Types.services, 
      body: body,
      fromMap: (Map<String, dynamic> val)=> ToDoList.fromMap(val));

///  getting models list
///  test_SomeService  -  service name 
///  getToDoList - method name
///  Types - enum
/// formMap - function converting Map<String, dynamic> map to your Model
List<dynamic> modelsList =
    Kinfolk.getListModelRest(
      serviceName: "test_SomeService", 
      methodName: "getToDoList", 
      type: Types.services, 
      fromMap: (Map<String, dynamic> val)=> ToDoList.fromMap(val));

///  getting models list with request body
///  test_SomeService  -  service name 
///  getToDoList - method name
///  Types - enum
///  body - request body
/// formMap - function converting Map<String, dynamic> map to your Model
List<dynamic> modelsList =
    Kinfolk.getListModelRest(
      serviceName: "test_SomeService", 
      methodName: "getToDoList", 
      type: Types.services, 
      body: body,
      fromMap: (Map<String, dynamic> val)=> ToDoList.fromMap(val));


/// Manual rest service usage. only if you want full control

///  url to service 
String url =
    Kinfolk.createRestUrl("test_SomeService", "setToDoList", Types.services);

///  request body 
String body = """
    {
    "monday":"work",
     "sunday":"relax"
    }
""";

/// getting client from saved Access Token
oauth2.Client client = await Kinfolk.getClient();

// getting response from server. POST method
var response =
    await client.post(url, body: body, headers: Kinfolk.appJsonHeader);

/// printing body of response
print("${response.body}");

Author #

Yerassyl Maikhanov - Enterprise Applications Developer. My Linkedin

[0.0.8] - 03.06.2020 #

  • Added entities and queries support

[0.0.7] - 10.04.2020 #

  • fix bugs in access token

[0.0.6] - 10.04.2020 #

  • fix bug in access token

[0.0.5] - 10.04.2020 #

  • Added Hive, for integration with Flutter Web

[0.0.4] - 06.04.2020 #

  • Added simple getting Single and List models

[0.0.3] - 03.04.2020 #

  • Prepared for publishing

[0.0.2] - 22.03.2020 #

  • Created useful url constructor

[0.0.1] - 21.03.2020 #

  • Created core REST helpers for CUBA Platform based backend

Use this package as a library

1. Depend on it

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


dependencies:
  kinfolk: ^0.0.8

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:kinfolk/kinfolk.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
40
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
66
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
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform Android

Because:

  • package:kinfolk/kinfolk.dart that imports:
  • package:hive_flutter/hive_flutter.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: Linux

Package does not support Flutter platform Web

Because:

  • package:kinfolk/kinfolk.dart that imports:
  • package:hive_flutter/hive_flutter.dart that imports:
  • package:path_provider/path_provider.dart that declares support for platforms: Android, iOS, Linux, macOS

Package does not support Flutter platform Windows

Because:

  • package:kinfolk/kinfolk.dart that imports:
  • package:hive_flutter/hive_flutter.dart that imports:
  • package:path_provider/path_provider.dart that declares support for platforms: Android, iOS, Linux, macOS

Package does not support Flutter platform iOS

Because:

  • package:kinfolk/kinfolk.dart that imports:
  • package:hive_flutter/hive_flutter.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: Linux

Package does not support Flutter platform macOS

Because:

  • package:kinfolk/kinfolk.dart that imports:
  • package:hive_flutter/hive_flutter.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: Linux

Package not compatible with SDK dart

Because:

  • kinfolk that is a package requiring null.

Health suggestions

Fix lib/kinfolk.dart. (-0.50 points)

Analysis of lib/kinfolk.dart reported 1 hint:

line 3 col 8: Unused import: 'dart:io'.

Format lib/global_variables.dart.

Run flutter format to format lib/global_variables.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

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

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
flutter 0.0.0
hive ^1.4.1+1 1.4.1+1
hive_flutter ^0.3.0+2 0.3.0+2
oauth2 ^1.5.0 1.6.1
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
convert 2.1.1
crypto 2.1.5
file 5.2.1
http 0.12.1
http_parser 3.1.4
intl 0.16.1
meta 1.1.8 1.2.2
path 1.6.4 1.7.0
path_provider 1.6.11
path_provider_linux 0.0.1+2
path_provider_macos 0.0.4+3
path_provider_platform_interface 1.0.2
pedantic 1.9.0 1.9.2
platform 2.2.1
plugin_platform_interface 1.0.2
process 3.0.13
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 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
xdg_directories 0.1.0