parseAuthTypes function

String parseAuthTypes(
  1. List<String> authenticationTypes
)

returns the list of auth types by removing the last comma

Implementation

String parseAuthTypes(List<String> authenticationTypes) {
  String auth = '';

  for (int i = 0; i < authenticationTypes.length; i++) {
    final String _auth = authenticationTypes[i];
    //. check if its last or only item so as not to
    // append a comma
    if ((i + 1) == authenticationTypes.length) {
      auth = '$auth${'$_auth '}';
    } else {
      auth = '$auth${'$_auth & '}';
    }
  }

  return auth;
}