p-hatan/ mirror

pub repository

mirror.p-hatan.com

boolean_selector

2.1.2

A flexible syntax for boolean expressions, based on a simplified version of Dart's expression syntax.

Cached in Iran · Upstream SHA-256 matched

Download archive

Readme

Build Status Pub Package package publisher

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 BooleanSelector.parse(), and evaluated against a set of variables using BooleanSelector.evaluate(). The variables are supplied 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 = 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.

Changelog

2.1.2

  • Increase the SDK minimum to 3.1.0.
  • Move to dart-lang/tools monorepo.

2.1.1

  • Increase the SDK minimum to 2.17.0.
  • Populate the pubspec repository field.

2.1.0

  • Stable release for null safety.

2.0.0

  • Breaking: BooleanSelector.evaluate always takes a bool Function(String). For use cases previously passing a Set<String>, tear off the .contains method. For use cases passing an Iterable<String> it may be worthwhile to first use .toSet() before tearing off .contains.

1.0.5

  • Update package metadata & add example/ folder

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.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add boolean_selector
pubspec.yaml
name: boolean_selector
version: 2.1.2
description: >-
  A flexible syntax for boolean expressions, based on a simplified version of
  Dart's expression syntax.
repository: https://github.com/dart-lang/tools/tree/main/pkgs/boolean_selector

environment:
  sdk: ^3.1.0

dependencies:
  source_span: ^1.8.0
  string_scanner: ^1.1.0

dev_dependencies:
  dart_flutter_team_lints: ^3.0.0
  test: ^1.16.0

Version history

VersionPublishedArchiveSHA-256
1.0.02016-02-18T22:35:08.883ZCachedc67977e3b3b184ae44f21f5373ae105abb696e9083ed61a6ba4488b3a696d270
1.0.12016-04-01T00:26:54.125ZCached69df26530c9d985cc6245acd0bdb34abd8bcfc9b5e763a045be43e24c80dfdfb
1.0.22016-06-21T20:55:02.570ZCachedfd70dd881d04c4e6d89f07e0045c371551ddc083aa6f0fcb1dbab85a85b9875d
1.0.32018-03-06T22:15:31.212296ZCached7fa39dcbf249af7c1295809533c916d3ac36e1bc0807fa926b81298a9d28130a
1.0.42018-07-12T23:50:41.904659ZCachedb0bf93e583fd5b5bfacf3645605eab6c2950040803ac70fb8d542dced94f85c5
1.0.52019-06-19T16:16:40.958365ZCachedf14ce062cc620db677e62efb6421256b461622d5bb44f69bd8a6d0333fd63515
2.0.02020-01-24T00:43:27.016202ZCached306009f8cfe16bf280047940fff83a8fea7478f4f518257a693ee3e84ff0c537
2.1.0-nullsafety2020-07-29T17:40:24.612017ZCached01edbce1f2455cf75afca5fd85cc942de3794ce26031e15409a531659aa1e735
2.1.0-nullsafety.12020-09-22T15:41:39.201388ZCached5777b107425029e93923902589b6f6ca346dff1a17153698cfa59c1d0ac554e5
2.1.0-nullsafety.22020-10-23T21:38:03.193217ZCached81c080dddc67b66e3a87be27d094a28bb72edd457c21701c0ff067d261cae75b
2.1.0-nullsafety.32020-11-03T22:13:38.607893ZCached86dfda9ce36092905a237219acca52ea594e3768fb635f82521b1d03a90e4808
2.1.02021-02-03T01:22:27.244271ZCached5bbf32bc9e518d41ec49718e2931cd4527292c9b0c6d2dffcf7fe6b9a8a8cf72
2.1.12022-10-26T20:30:45.002834ZCached6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66
2.1.22024-10-22T08:24:19.635674ZCached8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea

Dependencies

source_span "^1.8.0"

string_scanner "^1.1.0"