// https://www.geeksforgeeks.org/python-set-operations-union-intersection-difference-symmetric-difference/ // https://dart.cn/guides/language/extension-methods#implementing-generic-extensions // https://api.dart.cn/stable/2.18.1/dart-core/Set-class.html extension EhancedSet on Set { Set operator |(Set anotherSet) => union(anotherSet); Set operator &(Set anotherSet) => intersection(anotherSet); Set operator -(Set anotherSet) => difference(anotherSet); Set operator ^(Set anotherSet) => union(anotherSet).difference(intersection(anotherSet)); } void main() { var gfg1 = {"GeeksForGeeks", "Geek1", "Geek2", "Geek3"}; var gfg2 = {"GeeksForGeeks", "Geek3", "Geek4", "Geek5"}; print(gfg1 | gfg2); print(gfg1 & gfg2); print(gfg1 - gfg2); print(gfg1 ^ gfg2); }