p-hatan/ mirror

pub repository

mirror.p-hatan.ir

boolean_selector

1.0.2

A flexible syntax for boolean expressions.

Download archive

Readme

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.

Changelog

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.ir
flutter pub add boolean_selector
pubspec.yaml
name: boolean_selector
version: 1.0.2
description: A flexible syntax for boolean expressions.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/boolean_selector

environment:
  sdk: '>=1.8.0 <2.0.0'

dependencies:
  collection: '^1.5.0'
  source_span: '^1.0.0'
  string_scanner: '>=0.1.1 <2.0.0'

dev_dependencies:
  test: '^0.12.0'

Version history

VersionPublishedArchiveSHA-256
1.0.02016-02-18T22:35:08.883ZDownloadc67977e3b3b184ae44f21f5373ae105abb696e9083ed61a6ba4488b3a696d270
1.0.12016-04-01T00:26:54.125ZDownload69df26530c9d985cc6245acd0bdb34abd8bcfc9b5e763a045be43e24c80dfdfb
1.0.22016-06-21T20:55:02.570ZDownloadfd70dd881d04c4e6d89f07e0045c371551ddc083aa6f0fcb1dbab85a85b9875d
1.0.32018-03-06T22:15:31.212296ZDownload7fa39dcbf249af7c1295809533c916d3ac36e1bc0807fa926b81298a9d28130a
1.0.42018-07-12T23:50:41.904659ZDownloadb0bf93e583fd5b5bfacf3645605eab6c2950040803ac70fb8d542dced94f85c5
1.0.52019-06-19T16:16:40.958365ZDownloadf14ce062cc620db677e62efb6421256b461622d5bb44f69bd8a6d0333fd63515
2.0.02020-01-24T00:43:27.016202ZDownload306009f8cfe16bf280047940fff83a8fea7478f4f518257a693ee3e84ff0c537
2.1.0-nullsafety2020-07-29T17:40:24.612017ZDownload01edbce1f2455cf75afca5fd85cc942de3794ce26031e15409a531659aa1e735
2.1.0-nullsafety.12020-09-22T15:41:39.201388ZDownload5777b107425029e93923902589b6f6ca346dff1a17153698cfa59c1d0ac554e5
2.1.0-nullsafety.22020-10-23T21:38:03.193217ZDownload81c080dddc67b66e3a87be27d094a28bb72edd457c21701c0ff067d261cae75b
2.1.0-nullsafety.32020-11-03T22:13:38.607893ZDownload86dfda9ce36092905a237219acca52ea594e3768fb635f82521b1d03a90e4808
2.1.02021-02-03T01:22:27.244271ZDownload5bbf32bc9e518d41ec49718e2931cd4527292c9b0c6d2dffcf7fe6b9a8a8cf72
2.1.12022-10-26T20:30:45.002834ZDownload6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66
2.1.22024-10-22T08:24:19.635674ZDownload8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea

Dependencies

collection "^1.5.0"

source_span "^1.0.0"

string_scanner "\u003e=0.1.1 \u003c2.0.0"