Home > Back-end >  Converting object to an encodable object failed: Instance of 'LeadSource'
Converting object to an encodable object failed: Instance of 'LeadSource'

Time:02-24

the problem in the integrating between flutter and graphql mutation when send a request to the server with a datatype called LeadSource i found in the schema. always get an exception with this error , and this is example for the code

     var response = runMutation({
                                'firstName': firstName,
                                'middleName': middleName,
                                'source': leadSource, // error is here ........
                                'leadCreatedById': leadCreatedBy,
                                'lastName': lastName,
                                'leadType': _leadType.toString(),
                                'leadStatus': _leadStatus.toString(),
                                'description': description,
                                'dob': _dateTime.toString(),
                                'gender': _genderType.toString(),
                                'address': address,
                                'countryId': countryId,
                                'cityId': cityId,
                                'jobTitle': jobTitle,
                                'email': email,
                                'nationality': nationality,
                                'companyId': companyId,
                                'marketingConsentSms': EmailFlag,
                                'marketingConsentEmail': SmsFlag,
                                'phoneCountryCode': '46723423',
                                'phoneNumber': '45787543',
                              }); 

and this is the leadSource datatype found in the schema

    enum LeadSource {
      FACEBOOK,
      LINKEDIN,
      INSTAGRAM,
      YOUTUBE,
      GOOGLE_ADS,
      WEBSITE,
      LANDING_PAGE,
      EXTERIOR_SIGNAGE,
      EMAIL,
      REFERRAL,
      FLYER,
      CORPORATE,
      SMS,
      SOCIAL_APP,
    }

CodePudding user response:

can you try leadSource.name or leadSource.index by sending data to service. (if you can't see name property, you should be update your dart latest version)

  • Related