boolean_selector 1.0.4

  • Installing
  • Versions
  • 92

The boolean_selector package defines a simple and flexible syntax for boolean expressions. It can be used for filtering based on user-defined expressions. For example, the test package uses boolean selectors to allow users to define what platforms their tests support.

The boolean selector syntax is based on a simplified version of Dart's expression syntax. Selectors can contain identifiers, parentheses, and boolean operators, including ||, &&, !, and ? :. Any valid Dart identifier is allowed, and identifiers may also contain hyphens. For example, chrome, chrome || content-shell, and js || (vm && linux) are all valid boolean selectors.

A boolean selector is parsed from a string using new BooleanSelector.parse(), and evaluated against a set of variables using BooleanSelector.evaluate(). The variables may be supplied as a list of strings, or as a function that takes a variable name and returns its value. For example:

import 'package:boolean_selector/boolean_selector.dart';

void main(List<String> args) {
  var selector = new BooleanSelector.parse("(x && y) || z");
  print(selector.evaluate((variable) => args.contains(variable)));

Versioning #

If this package adds new features to the boolean selector syntax, it will increment its major version number. This ensures that packages that expose the syntax to their users will be able to update their own minor versions, so their users can indicate that they rely on the new syntax.

1.0.4 #

  • Now requires Dart 2.

1.0.3 #

  • Work around an inference bug in the new common front-end.

1.0.2 #

  • Declare compatibility with string_scanner 1.0.0.

1.0.1 #

  • Fix all strong mode warnings.

1.0.0 #

  • Initial release.

Use this package as a library

1. Depend on it

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

  boolean_selector: ^1.0.4

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:boolean_selector/boolean_selector.dart';
Version Uploaded Documentation Archive
1.0.4 Jul 12, 2018 Go to the documentation of boolean_selector 1.0.4 Download boolean_selector 1.0.4 archive
1.0.3 Mar 6, 2018 Go to the documentation of boolean_selector 1.0.3 Download boolean_selector 1.0.3 archive
1.0.2 Jun 21, 2016 Go to the documentation of boolean_selector 1.0.2 Download boolean_selector 1.0.2 archive
1.0.1 Apr 1, 2016 Go to the documentation of boolean_selector 1.0.1 Download boolean_selector 1.0.1 archive
1.0.0 Feb 18, 2016 Go to the documentation of boolean_selector 1.0.0 Download boolean_selector 1.0.0 archive
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 Jun 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.2
  • pana: 0.12.18


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:boolean_selector/boolean_selector.dart.

Maintenance suggestions

The package description is too short. (-18 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

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 boolean_selector.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.58 <3.0.0
source_span ^1.0.0 1.5.5
string_scanner >=0.1.1 <2.0.0 1.0.4
Transitive dependencies
charcode 1.1.2
meta 1.1.7
path 1.6.2
term_glyph 1.1.0
Dev dependencies
test ^1.2.0