monalisa_client 0.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 47

monalisa_client #

Small library to authenticate your Flutter up with Monalisa API/SSO

Add to your project #

in your pubspec.yaml file

dependencies:
  flutter:
    sdk: flutter
  monalisa_client:
    git:
      url: https://github.com/mathieujobin/monalisa_client.git

assets:
  - assets/monalisa_config.json

Create and save your app token #

Visit https://monalisa.solidcode.bz/app

Create Config file #

{
  "base_url": "https://monalisa.solidcode.bz",
  "environment": "production",
  "client_application_name": "rockpaperscissors",
  "client_application_secret": "1234"
}

Basic usage #

import 'package:monalisa_client/monalisa_client.dart';
final MonalisaClient monalisa_client = MonalisaClient();

  @override
  void initState() {
    super.initState();

    monalisa_client.read_local_config().then((data) {
      return monalisa_client.ensure_user_token();
    }).then((data) {
      setState(() {
        // this is only to debug execution order,
        // setState should not be called before ensure_user_token is completed.
        // also to show how to access user_uuid
        if (monalisa_client.user_uuid == null) {
          throw Exception("user_uuid is missing");
        }
        _user_logged_in = true;
      });
    });
  }

Troubleshooting #

Minimum SDK version #

Because this tool depends on flutter_secure_storage and flutter apps still allow minSdk 16, you might need to upgrade your build.gradle file for Android

The error looks like this

/home/mathieu/projects/cyrus-kl/tasselvr-app/android/app/src/main/AndroidManifest.xml Error:
	uses-sdk:minSdkVersion 16 cannot be smaller than version 18 declared in library [:flutter_secure_storage] /home/mathieu/projects/cyrus-kl/tasselvr-app/build/flutter_secure_storage/intermediates/manifests/full/debug/AndroidManifest.xml as the library might be using APIs not available in 16
	Suggestion: use a compatible library with a minSdk of at most 16,
		or increase this project's minSdk version to at least 18,
		or use tools:overrideLibrary="com.it_nomads.fluttersecurestorage" to force usage (may lead to runtime failures)

Edit the android/app/build.gradle file, find the minSdkVersion 16 under defaultConfig, and make it 18

Dart/Flutter package resources #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.

example/README.md

foo #

A new Flutter project.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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


dependencies:
  monalisa_client: ^0.0.4

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

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

  • Dart: 2.6.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/monalisa_client.dart. (-9.54 points)

Analysis of lib/monalisa_client.dart reported 20 hints, including:

line 12 col 7: Name non-constant identifiers using lowerCamelCase.

line 13 col 10: Name non-constant identifiers using lowerCamelCase.

line 14 col 10: Name non-constant identifiers using lowerCamelCase.

line 15 col 24: Name non-constant identifiers using lowerCamelCase.

line 19 col 18: Name non-constant identifiers using lowerCamelCase.

Maintenance suggestions

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.1.0 <3.0.0
flutter 0.0.0
flutter_secure_storage ^3.2.0 3.3.1+1
http ^0.12.0 0.12.0+2
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.11 1.14.12
http_parser 3.1.3
meta 1.1.7 1.1.8
path 1.6.4
pedantic 1.8.0+1
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