import 'package:flutter/foundation.dart'; abstract class Describable { String get name; String? get description; } @immutable class _DescribableImp implements Describable { @override final String name; @override final String? description; const _DescribableImp({ required this.name, required this.description, }); } Describable newDescribable({required String name, String? description}) => _DescribableImp(name: name, description: description); extension DescribableCopier on Describable { Describable copyWith({ String? name, String? Function()? description, }) => newDescribable( name: name ?? this.name, description: description != null ? description() : this.description, ); } Describable describableCopyWithOther(Describable current, Describable? other) => current.copyWith( name: other?.name, description: () => other?.description, );