scarabei 4.0.0

  • Installing
  • Versions
  • 0


Pub Package GitHub Issues GitHub Forks GitHub Stars GitHub License

Набор Dart-компонентов, чтобы катать всякое говно

Similar to the Apache Commons ( Scarabei library provides a collection of open-source reusable components that you are missing in the official SDK.

Originally written in Java ( ScarabeiDart is a port to the Dart-language.

Scarabei strongly relies on the facade design pattern ( shielding your code from external libraries with an abstract API. The actual implementations of the API will be determined during runtime. The approach allows more flexibility in the development e.g. optional implementations and dependency injections ( (

The intent behind dependency injection is to decouple objects to the extent that no client code has to be changed simply because an object it depends on needs to be changed to a different one.

The proposed usage scenario for the library user (client library) is the following:

  • develop and compile your library code using Scarabei API
  • setup the actual implementations at the runtime right after your application entry point

Usage examples


L.d("Hello world");
L.d("message", message);
L.e("error", exception);

File systems

 Iterable<String> relativePathSteps = ['folderA', 'foo', 'bar', '1.txt']; //some strings

  RelativePath relative = Utils.newRelativePath(path_steps: relativePathSteps);
  // RelativePath is just a list of Strings with some useful operations like: child(), parent(), beginsWith() and so on.
  // We can reverse it, split or join. Anything you like.

//  L.d(""); this is how we print the logs here to a local console or to a remote log server;
  L.d("relative", relative); //prints the path to console > folderA/foo/bar/1.txt

  /*Now we can mount this relative path.
    - to root of a local file system
    - or to a web-site, like
    - or to InMemory file system (see below)
    - remote file system
    - or maybe it is a path in a binary tree or in a graph? Doesn't matter. It is generic!

  //Let's try it.
  //First we need a mount point. Let it be a local file system.
  FileSystem fileSystem = LocalFileSystem.invoke();

  //AbsolutePath is simply a composition of a mount point and a relative path. Let's compose it:
  AbsolutePath<FileSystem> pathAtFileSystem = Utils.newAbsolutePath(fileSystem, relative); // mount_point + relative = [filesystem]+path
  L.d("pathAtFileSystem", pathAtFileSystem);
  //AbsolutePath is not necessary a file-path as it was said above. It can be AbsolutePath<ZipArchiveFileSystem> or anything else.

  //Good. Now we can create files;
  File file = fileSystem.newFile(pathAtFileSystem);
  // let's go to the parent
  File parent = file.parent();
  //or the other way;
  var parentPath = pathAtFileSystem.parent();
  File sameParent = fileSystem.newFile(parentPath);

  //Let's see what we have here:
  L.d("parent", parent); // parent > @[PosixFileSystem] folderA/foo/bar
  L.d("sameParent", sameParent); //sameParent > @[PosixFileSystem] folderA/foo/bar/

  //Now where we are?
  File home = LocalFileSystem.ApplicationHome();
  L.d("home", home); // @[PosixFileSystem] C:/ScarabeiDart/ScarabeiDart/scarabei-desktop-red-example

  // Safety Pig
  // We will get to back to it later.
  //  _._ _..._ .-',     _.._(`))
  // '-. `     '  /-._.-'    ',/
  //    )         \            '.
  //   / _    _    |             \
  //  |  a    a    /              |
  //  \   .-.                     ;
  //   '-('' ).-'       ,'       ;
  //      '-;           |      .'
  //         \           \    /
  //         | 7  .__  _.-\   \
  //         | |  |  ``/  /`  /
  //        /,_|  |   /,_/   /
  //           /,_/      '`-'

  //Let's see what we have here
  L.d("home.dir", home.listAllChildren()); //*all files in the current folder*

  //Lets go to the  folderA/foo/bar/1.txt
  File txtFile = home.proceed(relative); //C:/ScarabeiDart/ScarabeiDart/scarabei-desktop-red-example/folderA/foo/bar/1.txt
  txtFile.writeString("Hello txt file!");

  //Now let's try something else. Like InMemoryFileSystem.
  InMemoryFileSystem virtual = new InMemoryFileSystem();
  File root = virtual.ROOT(); //it is empty

  //Let's copy the whole current directory to the root.
  fileSystem.copyFolderContentsToFolder(home, root);

  //Let's see the result;
  L.d("virtual file system content", root.listAllChildren());

  //Now let's copy it back to the hard drive
  File tmp = home.child("tmp");
  fileSystem.copyFolderContentsToFolder(root, tmp);

  //tmp contains a copy of the 1.txt file, let's find it;
  File txtFileCopy = tmp.proceed(relative);
  String message = txtFileCopy.readString();
  L.d("message", message); //"Hello txt file!" Hello, fella!

  //time to clean-up the mess;
  File folderA = home.child(relative.getStep(0));

  // Now actually if you look carefully you'll see that our code depends on an abstract file API and doesn't care about what is behind it.
  // Everything happening after the safety pig doesn't know anything about the filesystem of each file.
  // It can be a content of Amazon S3-bucket, an Android  APK file, or a bridge duplicating all IO operations on two hard drives.
  // Actually I wrote some massive code to pack game-assets for my games. And my code uses similar approach in Java. (Because sucks a lot).
  // So the assets packer reads some files, places them in temp directories and deploys all the stuff at the S3 bucket. Tha bucket is published via web server.
  // Later game engine downloads assets from web-server and deploys it at a local cache.
  // For all of these I use:
  // 1) InMemoryFileSystem - to store temp folders and to speed-up the packing process
  // 2) S3BucketFileSystem - to upload assets to the assets server
  // 3) HTTPFileSystem - reads files from a web server. This one is read-only.
  // 4) And of course WindowsFileSystem is my local machine and PosixFileSystem for Android and iOS devices.
  // Since the assets-packer and the game engine are working only with the abstraction (AbsolutePath<FileSystem> and the File)
  // they don't know anything about these file systems.  No idea if it is Posix or Windows or anything else.

  Sys.exit(); //Thank you for your time.

Use this package as a library

1. Depend on it

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

  scarabei: ^4.0.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:scarabei/scarabei.dart';
Version Uploaded Documentation Archive
4.0.0 Nov 2, 2017 Go to the documentation of scarabei 4.0.0 Download scarabei 4.0.0 archive
3.3.0 Oct 16, 2017 Go to the documentation of scarabei 3.3.0 Download scarabei 3.3.0 archive
3.2.0 Sep 29, 2017 Go to the documentation of scarabei 3.2.0 Download scarabei 3.2.0 archive
3.1.0 Sep 28, 2017 Go to the documentation of scarabei 3.1.0 Download scarabei 3.1.0 archive
3.0.0 Sep 27, 2017 Go to the documentation of scarabei 3.0.0 Download scarabei 3.0.0 archive
2.2.0 Nov 2, 2017 Go to the documentation of scarabei 2.2.0 Download scarabei 2.2.0 archive
2.1.0 Sep 22, 2017 Go to the documentation of scarabei 2.1.0 Download scarabei 2.1.0 archive
2.0.0 Sep 20, 2017 Go to the documentation of scarabei 2.0.0 Download scarabei 2.0.0 archive
1.5.1 Sep 20, 2017 Go to the documentation of scarabei 1.5.1 Download scarabei 1.5.1 archive
1.5.0 Sep 18, 2017 Go to the documentation of scarabei 1.5.0 Download scarabei 1.5.0 archive

All 32 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Health issues and suggestions

Document public APIs (-9.97 points)

641 out of 643 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Fix lib/api-flutter/mobile_device.dart. (-0.50 points)

Analysis of lib/api-flutter/mobile_device.dart reported 1 hint:

line 2 col 8: Unused import: 'package:scarabei/api/files/file.dart'.

Fix lib/api/lang/lang.dart. (-0.50 points)

Analysis of lib/api/lang/lang.dart reported 1 hint:

line 1 col 7: Name types using UpperCamelCase.

Format lib/api-flutter/android/system_info_tags.dart.

Run dartfmt to format lib/api-flutter/android/system_info_tags.dart.

Fix additional 44 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/api-flutter/camera/setup.dart (Run dartfmt to format lib/api-flutter/camera/setup.dart.)
  • lib/api-flutter/flutter_camera.dart (Run dartfmt to format lib/api-flutter/flutter_camera.dart.)
  • lib/api/camera/camera.dart (Run dartfmt to format lib/api/camera/camera.dart.)
  • lib/api/camera/cameras.dart (Run dartfmt to format lib/api/camera/cameras.dart.)
  • lib/api/codec/codecs.dart (Run dartfmt to format lib/api/codec/codecs.dart.)
  • lib/api/codec/from_dart_encoder.dart (Run dartfmt to format lib/api/codec/from_dart_encoder.dart.)
  • lib/api/codec/scarabei_class_names.dart (Run dartfmt to format lib/api/codec/scarabei_class_names.dart.)
  • lib/api/component_installer.dart (Run dartfmt to format lib/api/component_installer.dart.)
  • lib/api/cross-platform/cross_platform_calls.dart (Run dartfmt to format lib/api/cross-platform/cross_platform_calls.dart.)
  • lib/api/cross-platform/method_argument.dart (Run dartfmt to format lib/api/cross-platform/method_argument.dart.)
  • lib/api/cross-platform/method_call.dart (Run dartfmt to format lib/api/cross-platform/method_call.dart.)
  • lib/api/db/database.dart (Run dartfmt to format lib/api/db/database.dart.)
  • lib/api/db/dbeditor.dart (Run dartfmt to format lib/api/db/dbeditor.dart.)
  • lib/api/db/table_schema.dart (Run dartfmt to format lib/api/db/table_schema.dart.)
  • lib/api/debug/debug.dart (Run dartfmt to format lib/api/debug/debug.dart.)
  • lib/api/debug/state_switcher.dart (Run dartfmt to format lib/api/debug/state_switcher.dart.)
  • lib/api/display/display_metrics.dart (Run dartfmt to format lib/api/display/display_metrics.dart.)
  • lib/api/error/err.dart (Run dartfmt to format lib/api/error/err.dart.)
  • lib/api/files/file_hash.dart (Run dartfmt to format lib/api/files/file_hash.dart.)
  • lib/api/files/file_system.dart (Run dartfmt to format lib/api/files/file_system.dart.)
  • lib/api/files/local_file_system.dart (Run dartfmt to format lib/api/files/local_file_system.dart.)
  • lib/api/io/file_not_found_exception.dart (Run dartfmt to format lib/api/io/file_not_found_exception.dart.)
  • lib/api/io/hash.dart (Run dartfmt to format lib/api/io/hash.dart.)
  • lib/api/io/io_exception.dart (Run dartfmt to format lib/api/io/io_exception.dart.)
  • lib/api/json/json.dart (Run dartfmt to format lib/api/json/json.dart.)
  • lib/api/json/json_string.dart (Run dartfmt to format lib/api/json/json_string.dart.)
  • lib/api/log/logger.dart (Run dartfmt to format lib/api/log/logger.dart.)
  • lib/api/md5/md5.dart (Run dartfmt to format lib/api/md5/md5.dart.)
  • lib/api/md5/md5_string.dart (Run dartfmt to format lib/api/md5/md5_string.dart.)
  • lib/api/memory/memory_manager.dart (Run dartfmt to format lib/api/memory/memory_manager.dart.)
  • lib/api/mobile/system_info_tags.dart (Run dartfmt to format lib/api/mobile/system_info_tags.dart.)
  • lib/api/names/names.dart (Run dartfmt to format lib/api/names/names.dart.)
  • lib/api/path/absolute_path.dart (Run dartfmt to format lib/api/path/absolute_path.dart.)
  • lib/api/path/mount_point.dart (Run dartfmt to format lib/api/path/mount_point.dart.)
  • lib/api/path/relative_path.dart (Run dartfmt to format lib/api/path/relative_path.dart.)
  • lib/api/strings/strings.dart (Run dartfmt to format lib/api/strings/strings.dart.)
  • lib/api/sys/execution_mode.dart (Run dartfmt to format lib/api/sys/execution_mode.dart.)
  • lib/api/sys/on_exit_listener.dart (Run dartfmt to format lib/api/sys/on_exit_listener.dart.)
  • lib/api/sys/settings/system_settings.dart (Run dartfmt to format lib/api/sys/settings/system_settings.dart.)
  • lib/api/sys/sys.dart (Run dartfmt to format lib/api/sys/sys.dart.)
  • lib/api/sys/system_info_tags.dart (Run dartfmt to format lib/api/sys/system_info_tags.dart.)
  • lib/api/time/time_stream.dart (Run dartfmt to format lib/api/time/time_stream.dart.)
  • lib/api/utils/utils.dart (Run dartfmt to format lib/api/utils/utils.dart.)
  • lib/api/ver/version.dart (Run dartfmt to format lib/api/ver/version.dart.)

Maintenance issues and suggestions

Add SDK constraint in pubspec.yaml. (-50 points)

For information about setting SDK constraint, please see

Maintain (-20 points)

Changelog entries help clients to follow the progress in your code.

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use scarabei.dart.

Package is getting outdated. (-9.04 points)

The package was released 56 weeks ago.