betto_codec_recordjar 0.1.0-dev.1
betto_codec_recordjar: ^0.1.0-dev.1 copied to clipboard
Read and write data in the Record Jar format. The record jar format uses `%%` to separate records. Each record is a set of key/value pairs.
// 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_recordjar/betto_codec_recordjar.dart';
const planetsJar = r'''
Planet: Mercury
Orbital-Radius: 57,910,000 km
Diameter: 4,880 km
Mass: 3.30e23 kg
%%
Planet: Venus
Orbital-Radius: 108,200,000 km
Diameter: 12,103.6 km
Mass: 4.869e24 kg
%%
Planet: Earth
Orbital-Radius: 149,600,000 km
Diameter: 12,756.3 km
Mass: 5.972e24 kg
Moons: Luna
''';
void main() {
final data = recordJar.decode(planetsJar);
for (var entry in data) {
print(entry);
}
}