Add custom class to li element which has children

Please take a look at this walker class (Bootstrap Nav Walker) you’ll get a good understanding of how things work inside a walker. There is a has_children property in $args argument $args->has_children. You can use this to check if the current item has any children or not like the following code

if ( $args->has_children ) {
    // do whatever you want
}