kotlin_flavor 0.1.0

kotlin_flavor #

Are you Android-app engineer, and eager to use scope functions also in Dart?

Yes, kotlin_flavor/scope_functions provides it for you! :)

import 'package:kotlin_flavor/scope_functions.dart'

bool handle(Shop selectedShop) {
  return selectedShop?.let((shop) {
    return true;
  }) ?? run(() {
    return false;

kotlin_flavor/scope_functions #

let #

Often used for executing a code block only with non-null values.

someNullable?.let((it) { ... });

also #

Used for additional actions that don't alter the object, such as logging or printing debug information.

something.also((it) { ... }); // returns something.

run #

Used for evaluating a block of several statements where an expression is required.

someNullable ?? run(() {
  var defaultValue = ......;
  // several process...

  return defaultValue;

Development #

$ docker-compose pull
$ docker-compose run --rm dart

will build a Dart development environment for you.

Ensure all test successfully pass, every after you change some codes:

$ pub run test

Use this package as a library

1. Depend on it

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

  kotlin_flavor: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or 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:kotlin_flavor/scope_functions.dart';
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.

We analyzed this package on Jul 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Health issues and suggestions

Document public APIs. (-1 points)

6 out of 6 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance issues and suggestions

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

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

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

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

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0-dev.6.0 <3.0.0
Dev dependencies
test ^1.9.3