From 271634d5675bad243af81e798042d7303e481a00 Mon Sep 17 00:00:00 2001 From: Luigi Massa Date: Tue, 13 Oct 2020 10:02:55 +0200 Subject: [PATCH] Error flutter/dart I've this error when create the object and try to set any properties: Variables must be declared using the keywords 'const', 'final', 'var' or a type name. Try adding the name of the type of the variable or the keyword 'var'.dart(missing_const_final_var_or_type) --- lib/vcard.dart | 52 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/lib/vcard.dart b/lib/vcard.dart index 50d3144..0fd0730 100644 --- a/lib/vcard.dart +++ b/lib/vcard.dart @@ -12,6 +12,43 @@ import 'vcard_formatter.dart'; /// vCard, Valery Colong, May 2019 class VCard { + VCard( + {this.anniversary, + this.birthday, + this.cellPhone, + this.email, + this.firstName, + this.formattedName, + this.gender, + this.homeAddress, + this.homeFax, + this.homePhone, + this.isOrganization, + this.jobTitle, + this.lastName, + this.logo, + this.middleName, + this.namePrefix, + this.nameSuffix, + this.nickname, + this.note, + this.organization, + this.otherEmail, + this.otherPhone, + this.pagerPhone, + this.photo, + this.role, + this.socialUrls, + this.source, + this.uid, + this.url, + this.version, + this.workAddress, + this.workEmail, + this.workFax, + this.workPhone, + this.workUrl}); + /// Specifies a value that represents a persistent, globally unique identifier associated with the vCard String uid; @@ -61,7 +98,7 @@ class VCard { String gender; /// Home mailing address - MailingAddress homeAddress = MailingAddress('HOME'); + MailingAddress homeAddress = MailingAddress(type: 'HOME'); /// Home phone var homePhone; @@ -101,7 +138,7 @@ class VCard { String workUrl; /// Work mailing address - MailingAddress workAddress = MailingAddress('WORK'); + MailingAddress workAddress = MailingAddress(type: 'WORK'); /// Work phone var workPhone; @@ -194,6 +231,15 @@ class Photo { } class MailingAddress { + MailingAddress( + {this.label, + this.city, + this.countryRegion, + this.postalCode, + this.stateProvince, + this.street, + this.type}); + /// Represents the actual text that should be put on the mailing label when delivering a physical package String label = ''; @@ -213,6 +259,4 @@ class MailingAddress { String countryRegion = ''; final String type; - - MailingAddress(this.type); }