@@ -40,7 +40,9 @@ abstract class NotusAttributeBuilder<T> implements NotusAttributeKey<T> {
40
40
41
41
final String key;
42
42
final NotusAttributeScope scope;
43
+
43
44
NotusAttribute <T > get unset => new NotusAttribute <T >._(key, scope, null );
45
+
44
46
NotusAttribute <T > withValue (T value) =>
45
47
new NotusAttribute <T >._(key, scope, value);
46
48
}
@@ -77,7 +79,6 @@ class NotusAttribute<T> implements NotusAttributeBuilder<T> {
77
79
NotusAttribute .heading.key: NotusAttribute .heading,
78
80
NotusAttribute .block.key: NotusAttribute .block,
79
81
NotusAttribute .embed.key: NotusAttribute .embed,
80
- NotusAttribute .container.key: NotusAttribute .container,
81
82
};
82
83
83
84
// Inline attributes
@@ -123,9 +124,6 @@ class NotusAttribute<T> implements NotusAttributeBuilder<T> {
123
124
/// Embed style attribute.
124
125
static const embed = const EmbedAttributeBuilder ._();
125
126
126
- /// Container attribute
127
- static const container = const ContainerAttributeBuilder ._();
128
-
129
127
static NotusAttribute _fromKeyValue (String key, dynamic value) {
130
128
if (! _registry.containsKey (key))
131
129
throw new ArgumentError .value (
@@ -332,6 +330,7 @@ class _ItalicAttribute extends NotusAttribute<bool> {
332
330
/// [NotusAttribute.link] instead.
333
331
class LinkAttributeBuilder extends NotusAttributeBuilder <String > {
334
332
static const _kLink = 'a' ;
333
+
335
334
const LinkAttributeBuilder ._() : super ._(_kLink, NotusAttributeScope .inline);
336
335
337
336
/// Creates a link attribute with specified link [value] .
@@ -345,6 +344,7 @@ class LinkAttributeBuilder extends NotusAttributeBuilder<String> {
345
344
/// [NotusAttribute.heading] instead.
346
345
class HeadingAttributeBuilder extends NotusAttributeBuilder <int > {
347
346
static const _kHeading = 'heading' ;
347
+
348
348
const HeadingAttributeBuilder ._()
349
349
: super ._(_kHeading, NotusAttributeScope .line);
350
350
@@ -364,6 +364,7 @@ class HeadingAttributeBuilder extends NotusAttributeBuilder<int> {
364
364
/// [NotusAttribute.block] instead.
365
365
class BlockAttributeBuilder extends NotusAttributeBuilder <String > {
366
366
static const _kBlock = 'block' ;
367
+
367
368
const BlockAttributeBuilder ._() : super ._(_kBlock, NotusAttributeScope .line);
368
369
369
370
/// Formats a block of lines as a bullet list.
@@ -453,49 +454,3 @@ class EmbedAttribute extends NotusAttribute<Map<String, dynamic>> {
453
454
return hashObjects (objects);
454
455
}
455
456
}
456
-
457
- class ContainerAttributeBuilder
458
- extends NotusAttributeBuilder <Map <String , dynamic >> {
459
- const ContainerAttributeBuilder ._()
460
- : super ._(ContainerAttribute ._kContainer, NotusAttributeScope .inline);
461
-
462
- @override
463
- NotusAttribute <Map <String , dynamic >> get unset => ContainerAttribute ._(null );
464
-
465
- NotusAttribute <Map <String , dynamic >> withValue (Map <String , dynamic > value) =>
466
- ContainerAttribute ._(value);
467
- }
468
-
469
- class ContainerAttribute extends NotusAttribute <Map <String , dynamic >> {
470
- static const _kValueEquality = const MapEquality <String , dynamic >();
471
- static const _kContainer = 'container' ;
472
-
473
- ContainerAttribute ._(Map <String , dynamic > value)
474
- : super ._(_kContainer, NotusAttributeScope .inline, value);
475
-
476
- @override
477
- NotusAttribute <Map <String , dynamic >> get unset => ContainerAttribute ._(null );
478
-
479
- @override
480
- bool operator == (other) {
481
- if (identical (this , other)) return true ;
482
- if (other is ! ContainerAttribute ) return false ;
483
- ContainerAttribute typedOther = other;
484
- return key == typedOther.key &&
485
- scope == typedOther.scope &&
486
- _kValueEquality.equals (value, typedOther.value);
487
- }
488
-
489
- @override
490
- int get hashCode {
491
- final objects = [key, scope];
492
- if (value != null ) {
493
- final valueHashes =
494
- value.entries.map ((entry) => hash2 (entry.key, entry.value));
495
- objects.addAll (valueHashes);
496
- } else {
497
- objects.add (value);
498
- }
499
- return hashObjects (objects);
500
- }
501
- }
0 commit comments