-
Notifications
You must be signed in to change notification settings - Fork 34
Merge package:convert
#134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 105 commits
Commits
Show all changes
107 commits
Select commit
Hold shift + click to select a range
ed782b7
Add template files.
nex3 d9d51d0
Update the README and pubspec for this package.
nex3 0f4f74c
Add a hexadecimal codec.
nex3 2ea7048
Add a percent-encoding converter.
nex3 59b0157
Use the new Uint8Buffer.addAll start and end params.
nex3 75f50b5
Add sinks to provide synchronous access to events.
nex3 3948ffd
Make the package strong-mode clean.
nex3 7e211ae
Stop implementing ChunkedConverter.
nex3 376ee4e
Stop percent-encoding of numbers.
DanTup 2f91ade
Bump the version.
nex3 5c2d74e
Don't percent-encode digits.
nex3 255f9c4
Add travis support and dartfmt... (dart-lang/convert#6)
matanlurey e262932
Use recommended analysis_options name, support Dart v2-dev, test on F…
kevmoo 5c6796b
Remove -dev.infinity in SDK upper constraint
kevmoo 2de436b
Stop testing Dartium (dart-lang/convert#12)
nex3 5a00216
Fix a Dart 2 runtime test failure (dart-lang/convert#14)
nex3 16ef053
chore: set max SDK version to <3.0.0 (dart-lang/convert#15)
chalin fd09f82
Test on Chrome on Travis (dart-lang/convert#16)
kevmoo 1da0fa0
Added IdentityCodec (dart-lang/convert#17)
jonasfj db8d765
Make _IdentityConverter compatible with Dart SDK 1.x (dart-lang/conve…
aaronlademann-wf 07f50d4
Enable and fix standard lints, test on oldest supported SDK (dart-lan…
kevmoo 4b71f31
Ignore substantial failing lints from latest pedantic
kevmoo 6fc78e5
remove author from pubspec
kevmoo 685bb32
Delete .test_config
kevmoo b026bb4
Migrate to null safety (dart-lang/convert#32)
natebosch 8b9b571
Update version and add changelog for null safety (dart-lang/convert#33)
natebosch 2db2e80
Add Code Page support. (dart-lang/convert#26)
lrhn beba2c4
Allow the 2.10 stable and 2.11.0-dev SDKs (dart-lang/convert#36)
natebosch ea3a25f
Update SDK constraint to 2.12.0-0 (dart-lang/convert#38)
kevmoo 1e972ca
Make the package not depend directly on package:charcode. (dart-lang/…
lrhn bf19f3b
prepare to publish convert (dart-lang/convert#39)
kevmoo ed5871a
remove redundant experiment
pq d40fb7c
Merge pull request dart-lang/convert#40 from dart-lang/pq-patch-1
pq d15468d
Increase package description to >=60 characters and added an example …
kevmoo 5396217
Migrate to GitHub Actions (dart-lang/convert#43)
athomas 420f195
stable null safety release (dart-lang/convert#45)
jakemac53 d5362b2
Update LICENSE
franklinyow ed1263e
Merge pull request dart-lang/convert#49 from dart-lang/franklinyow-pa…
franklinyow a6541c7
Latest CI setup, test oldest supported SDK (dart-lang/convert#50)
kevmoo 8a8a5bd
Remove dependency on package:charcode entirely. (dart-lang/convert#53)
lrhn 9687a3e
Prepare release without dependency on package:charcode (dart-lang/con…
lrhn 1dc4a8c
Move from pedantic to lints package (dart-lang/convert#55)
natebosch 2963df6
Add missing increment to custom code-page decoder. (dart-lang/convert…
lrhn 0a0700e
add markdown badges to the readme
devoncarew 0fee851
Merge pull request dart-lang/convert#65 from dart-lang/update_readme
devoncarew 01582d3
add license
mosuem c1b6966
Add fixed datetime parser/formatter
mosuem 135bfa5
rename
mosuem ce84dc8
add licenses
mosuem bb2aff9
add more changes as per review
mosuem e6b38a9
small name change
mosuem afed53a
rename files
mosuem b7059d6
apply changes as per review, convert to SOA
mosuem 1e1e569
fix some stuff
mosuem 0bab0cf
even faster
mosuem c585ffe
renaming
mosuem 9a16288
Remove unused variable
mosuem 1cca6f4
changes as per review
mosuem 79156fc
changes as per review
mosuem 85efafc
Duration to DateTime
mosuem 477c062
Add test to check for microseconds
mosuem 153a0e5
skip microsecond tests on web
mosuem b1cfee0
add documentation
mosuem 4549c32
Apply simple changes as per review
mosuem a9d222e
Add larger changes as per review
mosuem 2b01eef
Fix typo
mosuem 0927dc2
Changes as per review
mosuem a17a3a5
Add changelog entry
mosuem 67c1c16
Fix test
mosuem a70b420
Merge pull request dart-lang/convert#66 from dart-lang/introduce_date…
mosuem 20a0091
update the CI configuration (dart-lang/convert#67)
devoncarew 7c109a0
Bump version for publication (dart-lang/convert#68)
mosuem c076693
Fix comment references, update lints, require latest Dart SDK (dart-l…
kevmoo b0c3146
Bump actions/checkout from 3.1.0 to 3.2.0 (dart-lang/convert#73)
dependabot[bot] 597c82b
Bump dart-lang/setup-dart from 1.3 to 1.4 (dart-lang/convert#74)
dependabot[bot] 43b787f
Bump actions/checkout from 3.2.0 to 3.3.0 (dart-lang/convert#75)
dependabot[bot] ab9c130
Bump actions/checkout from 3.3.0 to 3.5.0 (dart-lang/convert#80)
dependabot[bot] 51007ee
Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (dart-lang/convert#79)
dependabot[bot] 90abcef
Require Dart 2.19, fix override param name, update lints (dart-lang/c…
kevmoo d0bc125
Bump actions/checkout from 3.5.0 to 3.5.2 (dart-lang/convert#82)
dependabot[bot] 3a7d656
blast_repo fixes (dart-lang/convert#83)
devoncarew e1b8879
Bump actions/checkout from 3.5.2 to 3.5.3 (dart-lang/convert#84)
dependabot[bot] 14db202
Bump actions/checkout from 3.5.3 to 3.6.0 (dart-lang/convert#86)
dependabot[bot] 2032999
Bump actions/checkout from 3.6.0 to 4.1.0 (dart-lang/convert#87)
dependabot[bot] 2d32c7e
Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (dart-lang/convert#88)
dependabot[bot] c9678d9
Bump actions/checkout from 4.1.0 to 4.1.1 (dart-lang/convert#90)
dependabot[bot] 0e3ac1e
Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (dart-lang/convert#89)
dependabot[bot] 37c9ad9
Add chunked decoding support to CodePage (dart-lang/convert#91)
brianquinlan 41149d2
blast_repo fixes (dart-lang/convert#96)
kevmoo ba40400
Enable and fix new lints (dart-lang/convert#97)
kevmoo 014be9e
Bump actions/stale from 8.0.0 to 9.0.0 (dart-lang/convert#98)
dependabot[bot] 652605e
Bump dart-lang/setup-dart from 1.6.0 to 1.6.2 (dart-lang/convert#100)
dependabot[bot] 0b54670
Test dart2wasm (dart-lang/convert#101)
kevmoo e702bb6
Bump actions/checkout from 4.1.1 to 4.1.2 (dart-lang/convert#102)
dependabot[bot] 4b526c4
Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/convert#104)
dependabot[bot] 3066dc8
Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/convert#103)
dependabot[bot] 488c42d
blast_repo fixes (dart-lang/convert#105)
devoncarew 449efc9
Bump actions/checkout from 4.1.4 to 4.1.6 in the github-actions group…
dependabot[bot] 4dbbc6c
⚡ Upper-cast the return type of the decoder (dart-lang/convert#99)
AlexV525 1bd5f63
latest lints, require Dart 3.4 (dart-lang/convert#107)
kevmoo 8d94c64
Bump the github-actions group with 2 updates (dart-lang/convert#108)
dependabot[bot] 30ce9ee
Bump actions/checkout from 4.1.7 to 4.2.0 in the github-actions group…
dependabot[bot] 9133afe
Merge package:convert into the core monorepo
mosuem df1ee69
Moving fixes
mosuem b0e5899
Add license to file
mosuem 3303cce
Changes as per review
mosuem cbf9a16
Merge branch 'main' into merge-convert-package
mosuem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| name: Dart CI | ||
mosuem marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| on: | ||
| # Run CI on pushes to the main branch, and on PRs against main. | ||
| push: | ||
| branches: [ main ] | ||
| paths: | ||
| - '.github/workflows/convert.yaml' | ||
| - 'pkgs/convert/**' | ||
| pull_request: | ||
| branches: [ main ] | ||
| paths: | ||
| - '.github/workflows/convert.yaml' | ||
| - 'pkgs/convert/**' | ||
| schedule: | ||
| - cron: "0 0 * * 0" | ||
| env: | ||
| PUB_ENVIRONMENT: bot.github | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: pkgs/convert/ | ||
|
|
||
| jobs: | ||
| # Check code formatting and static analysis on a single OS (linux) | ||
| # against Dart dev. | ||
| analyze: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| sdk: [dev] | ||
| steps: | ||
| - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 | ||
| - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 | ||
| with: | ||
| sdk: ${{ matrix.sdk }} | ||
| - id: install | ||
| name: Install dependencies | ||
| run: dart pub get | ||
| - name: Check formatting | ||
| run: dart format --output=none --set-exit-if-changed . | ||
| if: always() && steps.install.outcome == 'success' | ||
| - name: Analyze code | ||
| run: dart analyze --fatal-infos | ||
| if: always() && steps.install.outcome == 'success' | ||
|
|
||
| # Run tests on a matrix consisting of two dimensions: | ||
| # 1. OS: ubuntu-latest, (macos-latest, windows-latest) | ||
| # 2. release sdk: dev | ||
| test: | ||
| needs: analyze | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| # Add macos-latest and/or windows-latest if relevant for this package. | ||
| os: [ubuntu-latest] | ||
| sdk: [3.4, dev] | ||
| steps: | ||
| - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 | ||
| - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 | ||
| with: | ||
| sdk: ${{ matrix.sdk }} | ||
| - id: install | ||
| name: Install dependencies | ||
| run: dart pub get | ||
| - name: Run VM tests | ||
| run: dart test --platform vm | ||
| if: always() && steps.install.outcome == 'success' | ||
| - name: Run Chrome tests | ||
| run: dart test --platform chrome | ||
| if: always() && steps.install.outcome == 'success' | ||
| - name: Run Chrome tests - wasm | ||
| run: dart test --platform chrome --compiler dart2wasm | ||
| if: always() && steps.install.outcome == 'success' | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .dart_tool | ||
| .packages | ||
| pubspec.lock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Below is a list of people and organizations that have contributed | ||
| # to the project. Names should be added to the list like so: | ||
| # | ||
| # Name/Organization <email address> | ||
|
|
||
| Google Inc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| ## 3.1.2 | ||
|
|
||
| - Require Dart 3.4 | ||
| - Add chunked decoding support (`startChunkedConversion`) for `CodePage` | ||
| encodings. | ||
| - Upper-cast the return type of the decoder from `List<int>` to `Uint8List`. | ||
| - Move to `dart-lang/core` monorepo. | ||
|
|
||
| ## 3.1.1 | ||
|
|
||
| - Require Dart 2.18 | ||
| - Fix a number of comment references. | ||
|
|
||
| ## 3.1.0 | ||
|
|
||
| - Add a fixed-pattern DateTime formatter. See | ||
| [#210](https://github.com/dart-lang/intl/issues/210) in package:intl. | ||
|
|
||
| ## 3.0.2 | ||
|
|
||
| - Fix bug in `CodePage` class. See issue | ||
| [#47](https://github.com/dart-lang/convert/issues/47). | ||
|
|
||
| ## 3.0.1 | ||
|
|
||
| - Dependency clean-up. | ||
|
|
||
| ## 3.0.0 | ||
|
|
||
| - Stable null safety release. | ||
| - Added `CodePage` class for single-byte `Encoding` implementations. | ||
|
|
||
| ## 2.1.1 | ||
|
|
||
| - Fixed a DDC compilation regression for consumers using the Dart 1.x SDK that | ||
| was introduced in `2.1.0`. | ||
|
|
||
| ## 2.1.0 | ||
|
|
||
| - Added an `IdentityCodec<T>` which implements `Codec<T,T>` for use as default | ||
| value for in functions accepting an optional `Codec` as parameter. | ||
|
|
||
| ## 2.0.2 | ||
|
|
||
| - Set max SDK version to `<3.0.0`, and adjust other dependencies. | ||
|
|
||
| ## 2.0.1 | ||
|
|
||
| - `PercentEncoder` no longer encodes digits. This follows the specified | ||
| behavior. | ||
|
|
||
| ## 2.0.0 | ||
|
|
||
| **Note**: No new APIs have been added in 2.0.0. Packages that would use 2.0.0 as | ||
| a lower bound should use 1.0.0 instead—for example, `convert: ">=1.0.0 <3.0.0"`. | ||
|
|
||
| - `HexDecoder`, `HexEncoder`, `PercentDecoder`, and `PercentEncoder` no longer | ||
| extend `ChunkedConverter`. | ||
|
|
||
| ## 1.1.1 | ||
|
|
||
| - Fix all strong-mode warnings. | ||
|
|
||
| ## 1.1.0 | ||
|
|
||
| - Add `AccumulatorSink`, `ByteAccumulatorSink`, and `StringAccumulatorSink` | ||
| classes for providing synchronous access to the output of chunked converters. | ||
|
|
||
| ## 1.0.1 | ||
|
|
||
| - Small improvement in percent decoder efficiency. | ||
|
|
||
| ## 1.0.0 | ||
|
|
||
| - Initial version |
mosuem marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| Want to contribute? Great! First, read this page (including the small print at | ||
| the end). | ||
|
|
||
| ### Before you contribute | ||
| Before we can use your code, you must sign the | ||
| [Google Individual Contributor License Agreement](https://cla.developers.google.com/about/google-individual) | ||
| (CLA), which you can do online. The CLA is necessary mainly because you own the | ||
| copyright to your changes, even after your contribution becomes part of our | ||
| codebase, so we need your permission to use and distribute your code. We also | ||
| need to be sure of various other things—for instance that you'll tell us if you | ||
| know that your code infringes on other people's patents. You don't have to sign | ||
| the CLA until after you've submitted your code for review and a member has | ||
| approved it, but you must do it before we can put your code into our codebase. | ||
|
|
||
| Before you start working on a larger contribution, you should get in touch with | ||
| us first through the issue tracker with your idea so that we can help out and | ||
| possibly guide you. Coordinating up front makes it much easier to avoid | ||
| frustration later on. | ||
|
|
||
| ### Code reviews | ||
| All submissions, including submissions by project members, require review. | ||
|
|
||
| ### File headers | ||
| All files in the project must start with the following header. | ||
|
|
||
| // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | ||
| // for details. All rights reserved. Use of this source code is governed by a | ||
| // BSD-style license that can be found in the LICENSE file. | ||
|
|
||
| ### The small print | ||
| Contributions made by corporations are covered by a different agreement than the | ||
| one above, the | ||
| [Software Grant and Corporate Contributor License Agreement](https://developers.google.com/open-source/cla/corporate). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| Copyright 2015, the Dart project authors. | ||
|
|
||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are | ||
| met: | ||
|
|
||
| * Redistributions of source code must retain the above copyright | ||
| notice, this list of conditions and the following disclaimer. | ||
| * Redistributions in binary form must reproduce the above | ||
| copyright notice, this list of conditions and the following | ||
| disclaimer in the documentation and/or other materials provided | ||
| with the distribution. | ||
| * Neither the name of Google LLC nor the names of its | ||
| contributors may be used to endorse or promote products derived | ||
| from this software without specific prior written permission. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [](https://github.com/dart-lang/core/actions/workflows/convert.yaml) | ||
| [](https://pub.dev/packages/convert) | ||
| [](https://pub.dev/packages/convert/publisher) | ||
|
|
||
| Contains encoders and decoders for converting between different | ||
| data representations. It's the external counterpart of the | ||
| [`dart:convert`](https://api.dart.dev/dart-convert/dart-convert-library.html) | ||
| SDK library, and contains less-central APIs and APIs that need more flexible | ||
| versioning. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # https://dart.dev/guides/language/analysis-options | ||
| include: package:dart_flutter_team_lints/analysis_options.yaml | ||
|
|
||
| analyzer: | ||
| language: | ||
| strict-casts: true | ||
| strict-raw-types: true | ||
|
|
||
| linter: | ||
| rules: | ||
| - avoid_private_typedef_functions | ||
| - avoid_redundant_argument_values | ||
| - avoid_unused_constructor_parameters | ||
| - avoid_void_async | ||
| - cancel_subscriptions | ||
| - literal_only_boolean_expressions | ||
| - missing_whitespace_between_adjacent_strings | ||
| - no_adjacent_strings_in_list | ||
| - no_runtimeType_toString | ||
| - package_api_docs | ||
| - prefer_const_declarations | ||
| - prefer_expression_function_bodies | ||
| - unnecessary_await_in_return | ||
| - use_string_buffers |
23 changes: 23 additions & 0 deletions
23
pkgs/convert/benchmark/fixed_datetime_formatter_benchmark.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file | ||
| // for details. All rights reserved. Use of this source code is governed by a | ||
| // BSD-style license that can be found in the LICENSE file. | ||
|
|
||
| import 'package:benchmark_harness/benchmark_harness.dart'; | ||
| import 'package:convert/convert.dart'; | ||
|
|
||
| /// Test the performance of [FixedDateTimeFormatter.decode]. | ||
| class DecodeBenchmark extends BenchmarkBase { | ||
| final fixedDateTimeFormatter = FixedDateTimeFormatter('YYYYMMDDhhmmss'); | ||
| DecodeBenchmark() : super('Parse 10k strings to DateTime'); | ||
|
|
||
| @override | ||
| void run() { | ||
| for (var i = 0; i < 10000; i++) { | ||
| fixedDateTimeFormatter.decode('19960425050322'); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| void main() { | ||
| DecodeBenchmark().report(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file | ||
| // for details. All rights reserved. Use of this source code is governed by a | ||
| // BSD-style license that can be found in the LICENSE file. | ||
|
|
||
| import 'dart:convert'; | ||
|
|
||
| import 'package:convert/convert.dart'; | ||
|
|
||
| void main(List<String> args) { | ||
| // Creates a Codec that converts a UTF-8 strings to/from percent encoding | ||
| final fusedCodec = utf8.fuse(percent); | ||
|
|
||
| final input = args.isNotEmpty ? args.first : 'ABC 123 @!('; | ||
| print(input); | ||
| final encodedMessage = fusedCodec.encode(input); | ||
| print(encodedMessage); | ||
|
|
||
| final decodedMessage = fusedCodec.decode(encodedMessage); | ||
| assert(decodedMessage == input); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | ||
| // for details. All rights reserved. Use of this source code is governed by a | ||
| // BSD-style license that can be found in the LICENSE file. | ||
|
|
||
| export 'src/accumulator_sink.dart'; | ||
| export 'src/byte_accumulator_sink.dart'; | ||
| export 'src/codepage.dart'; | ||
| export 'src/fixed_datetime_formatter.dart'; | ||
| export 'src/hex.dart'; | ||
| export 'src/identity_codec.dart'; | ||
| export 'src/percent.dart'; | ||
| export 'src/string_accumulator_sink.dart'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | ||
| // for details. All rights reserved. Use of this source code is governed by a | ||
| // BSD-style license that can be found in the LICENSE file. | ||
|
|
||
| import 'dart:collection'; | ||
| import 'dart:convert'; | ||
|
|
||
| /// A sink that provides access to all the [events] that have been passed to it. | ||
| /// | ||
| /// See also [ChunkedConversionSink.withCallback]. | ||
| class AccumulatorSink<T> implements Sink<T> { | ||
| /// An unmodifiable list of events passed to this sink so far. | ||
| List<T> get events => UnmodifiableListView(_events); | ||
| final _events = <T>[]; | ||
|
|
||
| /// Whether [close] has been called. | ||
| bool get isClosed => _isClosed; | ||
| var _isClosed = false; | ||
|
|
||
| /// Removes all events from [events]. | ||
| /// | ||
| /// This can be used to avoid double-processing events. | ||
| void clear() { | ||
| _events.clear(); | ||
| } | ||
|
|
||
| @override | ||
| void add(T event) { | ||
| if (_isClosed) { | ||
| throw StateError("Can't add to a closed sink."); | ||
| } | ||
|
|
||
| _events.add(event); | ||
| } | ||
|
|
||
| @override | ||
| void close() { | ||
| _isClosed = true; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.