Skip to content

Valor padrão em atributo de Class #44

Discussion options

You must be logged in to vote

Opa,
Creio que você possa fazer dessa forma aqui:

class WorkerCommunication {
  final bool? agree;
  DateTime? agreeDate;

  WorkerCommunication({
    this.agree,
    DateTime? agreeDate
  }): agreeDate = agreeDate ?? DateTime.now();
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@John-Rocha
Comment options

@brunosemfio
Comment options

Answer selected by John-Rocha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants