I use navigation library and safeargs for passing data. I define argument to fragment like that.
Look for the class of the fragment which is the source of navigation. If you define navigation from FragmentA to FragmentB, you will find FragmentADirections class with the actions you defined (in nav_graph.xml) in it.
Then, to generate direction class ( Also argument class) you need to go Project level gradle then click the build command. Here I attached a screenshot to give a clear understanding.