Skip to main content

skill3th_core 0.1.2 copy "skill3th_core: ^0.1.2" to clipboard
skill3th_core: ^0.1.2 copied to clipboard

Flutter client for the Skill3 API: verify a site by domain, sign in users with automatic token refresh, and call any endpoint.

example/example.dart

// A command-line style outline of a Skill3 session. Replace the URLs and the
// credentials with your own before running it inside a Flutter app.
// ignore_for_file: avoid_print

import 'package:flutter/widgets.dart';
import 'package:skill3th_core/skill3th_core.dart';

Future<void> main() async {
  // The default storage (SharedPreferences) needs the Flutter binding.
  WidgetsFlutterBinding.ensureInitialized();

  // Create one client for the whole app and share it.
  final skill3 = createSkill3(
    const Skill3Config(
      scope: Skill3Scope.organ,
      environment: Skill3Environment(
        apiUrl: 'https://api.example.com',
        defaultDomain: 'app.example.com',
      ),
    ),
  );

  try {
    await skill3.site.authDomain('app.example.com');
    await skill3.auth.signInWithEmail('a@example.com', 'password');

    final Skill3List list = await skill3.custom.fetch.get(
      'land/areas',
      query: {'limit': 20},
    );
    print('${list.data} / ${list.total}');

    await skill3.auth.signOut();
  } on Skill3HttpError catch (err) {
    print('request failed: ${errorCode(err)} (status ${err.status})');
  }
}
0
likes
160
points
921
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter client for the Skill3 API: verify a site by domain, sign in users with automatic token refresh, and call any endpoint.

Homepage

License

MIT (license)

Dependencies

flutter, http, mime, shared_preferences

More

Packages that depend on skill3th_core