betto_codec_cookiejar 0.1.0-dev.1
betto_codec_cookiejar: ^0.1.0-dev.1 copied to clipboard
Read and write data in the Cookie Jar format. The cookie jar format uses `%` to separate records. Each record is a just a value - a bag of text.
// Copyright 2026 The Authors. See the AUTHORS file for details.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import 'package:betto_codec_cookiejar/betto_codec_cookiejar.dart'
show cookieJar;
const input = """A day for firm decisions!!!!! Or is it?
%
A few hours grace before the madness begins again.
%
A gift of a flower will soon be made to you.%% with a comment
""";
void main() {
final decoded = cookieJar.decode(input);
print('Decoded: \n');
for (final (i, entry) in decoded.indexed) {
print('Entry #$i: $entry');
}
print('---');
final encoded = cookieJar.encode(decoded);
print('Encoded: \n\n$encoded');
print('---');
print('Re-decoded: \n');
for (final (i, entry) in cookieJar.decode(encoded).indexed) {
print('Entry #$i: $entry');
}
print('---');
}