Line data Source code
1 : import 'package:widgetbook_generator/code_generators/instances/primary_instance.dart'; 2 : 3 : /// Implements a [String] instance 4 : class StringInstance extends PrimaryInstance<String> { 5 10 : const StringInstance.value( 6 : String value, 7 8 : ) : super( 8 : value: value, 9 : ); 10 : 11 3 : @override 12 : String toCode() { 13 6 : return "'$value'"; 14 : } 15 : 16 7 : @override 17 : bool operator ==(Object other) { 18 : if (identical(this, other)) return true; 19 : 20 28 : return other is StringInstance && other.value == value; 21 : } 22 : 23 0 : @override 24 0 : int get hashCode => value.hashCode; 25 : 26 0 : @override 27 0 : String toString() => 'StringInstance(value: $value)'; 28 : }