Category : conditional-operator

I am using a ternary operator in my Flutter application for checking the length of questions. child: isLoading ? Center( child: CircularProgressIndicator(), ) : this.questions.length == 2 ? Column( children: [ Text( "Quiz Started with ", style: TextStyle(color: Colors.white), ), ], ) : this.questions.length < 2 ? Text(‘Incomplete’, style: TextStyle(color: Colors.white),) : this.questions.length == null ..

Read more

so, I heard there are no ternary operators in kotlin, so, how can I achieve the following in kotlin data class JS {online.map(function(item){ return ( <div key={item.uid} > {item.Gender== ‘Male’ ? <li > <div><img src={item.photoURL}/><p><b>{item.displayName}</b></p></div> </li> : null} </div> ) })} online is an object that contains the list of user information {item.Gender === ‘Male’ ..

Read more