blob: 00dc1c9bef31c8763b226267ccda5243e8c42524 [file] [log] [blame]
// Copyright 2019 The Flutter Authors. 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:gcloud/db.dart';
import 'package:json_annotation/json_annotation.dart';
import 'key_helper.dart';
/// A converter for [Key]s encoded as strings.
class KeyConverter implements JsonConverter<Key, String> {
const KeyConverter();
@override
Key fromJson(String json) => json == null ? null : KeyHelper().decode(json);
@override
String toJson(Key key) => key == null ? null : KeyHelper().encode(key);
}