I have this sentence commerce_product--default which I want to extract only the last part so here default, to do so I'm using this RegEx RegExp(r'-\s*\K[^-]+$')
Now I try to display it in my code but I didn't find the method to do it, I've tried with stringMatch or replaceAll like this :
final type = 'commerce_product--default';
final newType = type.replaceAll(RegExp(r'-\s*\K[^-]+$'), type);
but it didn't work.
Thanks for the help
-with an empty string?^.*-