title: Jetpack Compose Navigation:How to pass an array as an argument?
body: <p>I have a filter dialog that shows filter options :</p>
  <p><a href="https://i.stack.imgur.com/7pAxql.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7pAxql.jpg" alt="enter image description here" /></a></p>
  <p>When I click on &quot;Parent Platform&quot; section I'm navigating to the <code>PlatformsScreen</code> with two arguments. Argument one is <code>parent</code> which is int and the second is platforms which is an array of int :</p>
  <pre><code>sealed class Screen(val route: String, val arguments: List&lt;NamedNavArgument&gt;) {
  
      object PlatformScreen : Screen(PLATFORM_ROUTE,arguments = 
          listOf(navArgument(&quot;parent&quot;, builder = {type = NavType.IntType}),
          navArgument(&quot;platforms&quot;,builder = {type = NavType.IntArrayType})))
  }
  
  
  // click action
  @Composable
  fun FilterDialog(
      modifier: Modifier = Modifier,
      viewModel: FilterViewModel,
      navigateToPlatformScreen: (Int,Array&lt;Int?&gt;) -&gt; Unit
  ) {
   val filterState by viewModel.filterState.collectAsState()
   Row(//other stuff
         .clickable {
                      navigateToPlatformScreen(filterState.parentPlatform?.id ?: -1,
                      filterState.platforms?.map { it?.id }?.toTypedArray() ?: arrayOf(-1))
                  }
  )
    //here is my filter bottom sheet
     bottomSheet(route = FILTER_ROUTE) {
          FilterDialog(viewModel = viewModel,
              navigateToPlatformScreen = { parentId,platforms -&gt;
                  navController.navigate(&quot;${Screen.PlatformScreen.route}?parent=${parentId}&amp;platforms=${platforms}&quot;)
              })
      }
  
      //platforms screen
      bottomSheet(route = Screen.PlatformScreen.route+&quot;?parent={parent}&amp;platforms={platforms}&quot;,arguments = Screen.PlatformScreen.arguments) { backstackEntry -&gt;
          val parent = backstackEntry.arguments?.getInt(&quot;parent&quot;)
          val platforms = backstackEntry.arguments?.getIntArray(&quot;platforms&quot;)
          PlatformScreen(parent = parent,platforms = platforms)
      }  
  
  </code></pre>
  <p>And as the last part, here is my <code>FilterViewModel</code> that holds my <code>parentId</code> and <code>platforms</code> array :</p>
  <pre><code>class FilterViewModel : ViewModel() {
  
      private val _selectedParentPlatform = MutableStateFlow&lt;ParentPlatform?&gt;(ParentPlatform())
  
      private val _filterState = MutableStateFlow(FilterState())
  
      val filterState:StateFlow&lt;FilterState&gt; get() = _filterState
  
      init {
          viewModelScope.launch {
             _selectedParentPlatform.mapLatest {
                 FilterState(
                     parentPlatform = it,
                     platforms = it?.platforms
                 )
             }
                  .catch { cause -&gt;
  
                  }
                  .collectLatest {
                      _filterState.value = it
                  }
          }
      }
  }
  </code></pre>
  <p>I have no problem with <code>parent</code> argument. I can pass it with no problem however the array type causing a crash with the following error:
  <code>java.lang.UnsupportedOperationException: Arrays don't support default values.</code></p>