import 'package:flutter_quill/models/documents/attribute.dart'; /* Collection of style attributes */ class Style { final Map _attributes; Style.attr(this._attributes); Style() : _attributes = {}; static Style fromJson(Map attributes) { if (attributes == null) { return Style(); } Map result = attributes.map((String key, dynamic value) { var attr = Attribute.fromKeyValue(key, value); return MapEntry(key, attr); }); return Style.attr(result); } Iterable get keys => _attributes.keys; Iterable get values => _attributes.values; bool get isEmpty => _attributes.isEmpty; bool get isNotEmpty => _attributes.isNotEmpty; bool get isInline => isNotEmpty && values.every((item) => item.isInline); Attribute get single => _attributes.values.single; bool containsKey(String key) => _attributes.containsKey(key); }