I use navigation library and safeargs for passing data. I define argument to fragment like that.
Took a bit to figure out but you need both action and arguments in your nav xml file to generate both.