missing_kotlin 0.0.1

  • Readme
  • Changelog
  • Installing
  • 62

missing_kotlin #

"Flutter is **** because it does not use Kotlin" Already heard it ? Prove them you can do the same thing as Kotlin using Flutter/Dart !

.let #

Work like .let in kotlin

final calculated = myMethod()?.let((v){
  return v*2;
}) ?? 0;

Will also break th chain if th expression is null

String variable; //null
final calculated = variable?.let((v) => v.length());

//here the expression is null, it will not execute the lambda
expect(calculated, null);

.also #

Work like .also in kotlin

final result = myMethod()?.also((v){
  print(v);
});

result here is the return value of myMethod()

.run #

Work like .run in kotlin

final calculated = myMethod()?.let((v){
  return v*2;
}) ?? run(() => 3);

.takeIf #

Work like .takeIf in kotlin

final calculated = myMethod()?.takeIf((v) => v == 3)?.let((v){
  return v*2;
}) ?? 0;

When #

final variable = 3;
final result = when(variable, [
    Case(2, () => "A"),
    Case(3, () => "B"),
    Default(() => "C"),
]);

//here the result is "B"
expect(calculated, null);

If #

Like a Kotlin if, returning a value, but with an Uppercase (because if is a reserved work)

final result = If(1 == 1, 
  () => "A", 
  Else: () => "B"
);

//here the result is "B"
expect(result, "B");

You can also chain statements

final result = If(variable2 == 2,
    () => "A",
  Else: () => 
    If(variable2 == 3,
        () => "B",
    Else: 
        () => "C"
  ),
);

//here the result is "C"
expect(result, "C");

[0.0.1] - TODO: Add release date. #

  • TODO: Describe initial release.

Use this package as a library

1. Depend on it

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


dependencies:
  missing_kotlin: ^0.0.1

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

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

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • missing_kotlin that is a package requiring null.

Health suggestions

Fix lib/src/if.dart. (-1 points)

Analysis of lib/src/if.dart reported 2 hints:

line 51 col 3: Name non-constant identifiers using lowerCamelCase.

line 51 col 62: Name non-constant identifiers using lowerCamelCase.

Fix lib/src/standard.dart. (-0.50 points)

Analysis of lib/src/standard.dart reported 1 hint:

line 73 col 3: This function has a return type of 'R', but doesn't end with a return statement.

Format lib/generated/i18n.dart.

Run flutter format to format lib/generated/i18n.dart.

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://github.com/florent37/Missing-Kotlin was unreachable.

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 missing_kotlin.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.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.1
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test