Search code examples
androidflutterdartjitsi

The setter 'featureFlag' isn't defined for the type 'JitsiMeetingOptions'


I am using the jitsi meet package for flutter and I have typed the code as per the documentation https://pub.dev/packages/jitsi_meet of the package, but still, there is some error in the app. The error says

The setter 'featureFlag' isn't defined for the type 'JitsiMeetingOptions'.
Try importing the library that defines 'featureFlag', correcting the name to the name of an existing setter, or defining a setter or field named 'featureFlag'.

And this is the joinMeeting function

joinMeeting() async {
    print(code);
    try {
      FeatureFlag featureFlag = FeatureFlag();
      featureFlag.welcomePageEnabled = false;
      featureFlag.resolution = FeatureFlagVideoResolution.MD_RESOLUTION;
      featureFlag.addPeopleEnabled = false;
      featureFlag.calendarEnabled = false;
      featureFlag.callIntegrationEnabled = false;
      featureFlag.inviteEnabled = false;
      featureFlag.kickOutEnabled = false;
      featureFlag.liveStreamingEnabled = false;
      featureFlag.meetingPasswordEnabled = false;
      featureFlag.recordingEnabled = false;
      featureFlag.serverURLChangeEnabled = false;
      featureFlag.tileViewEnabled = false;
      featureFlag.videoShareButtonEnabled = false;

      if (Platform.isIOS) {
        featureFlag.pipEnabled = false;
      }

      var options = JitsiMeetingOptions()
        ..room = code // Required, spaces will be trimmed
        ..userDisplayName = username == null ? 'Unidentified' : username
        ..audioMuted = false
        ..videoMuted = false
        ..featureFlag = featureFlag;

      await JitsiMeet.joinMeeting(options);
    } catch (err) {
      print(err);
    }
  }

The error is in the line ..featureFlag = featureFlag; which says

 The setter 'featureFlag' isn't defined for the type 'JitsiMeetingOptions'.
    Try importing the library that defines 'featureFlag', correcting the name to the name of an existing setter, or defining a setter or field named 'featureFlag'.

I have typed everything as per the documentation https://pub.dev/packages/jitsi_meet of the package but still the code does not seems to work. Any help on how to fix this error and make the code working would be of great help.


Solution

  • The featureflag has been changed in new version of jitsi meet plugin 3.0.0, but the changed code hasn't been mentioned in the main page of pub dev I.e https://pub.dev/packages/jitsi_meet. So please check out the example page where new changed syntax has been mentioned i.e https://pub.dev/packages/jitsi_meet/example .

    For example your code should look like this, find out which syntax needs to be changed according to new version:-

    _joinMeeting() async {
    String serverUrl =
        serverText.text?.trim()?.isEmpty ?? "" ? null : serverText.text;
    
    // Enable or disable any feature flag here
    // If feature flag are not provided, default values will be used
    // Full list of feature flags (and defaults) available in the README
    Map<FeatureFlagEnum, bool> featureFlags = {
      FeatureFlagEnum.WELCOME_PAGE_ENABLED: false,
    };
    if (!kIsWeb) {
      // Here is an example, disabling features for each platform
      if (Platform.isAndroid) {
        // Disable ConnectionService usage on Android to avoid issues (see README)
        featureFlags[FeatureFlagEnum.CALL_INTEGRATION_ENABLED] = false;
      } else if (Platform.isIOS) {
        // Disable PIP on iOS as it looks weird
        featureFlags[FeatureFlagEnum.PIP_ENABLED] = false;
      }
    }
    // Define meetings options here
    var options = JitsiMeetingOptions()
      ..room = roomText.text
      ..serverURL = serverUrl
      ..subject = subjectText.text
      ..userDisplayName = nameText.text
      ..userEmail = emailText.text
      ..iosAppBarRGBAColor = iosAppBarRGBAColor.text
      ..audioOnly = isAudioOnly
      ..audioMuted = isAudioMuted
      ..videoMuted = isVideoMuted
      ..featureFlags.addAll(featureFlags)
      ..webOptions = {
        "roomName": roomText.text,
        "width": "100%",
        "height": "100%",
        "enableWelcomePage": false,
        "chromeExtensionBanner": null,
        "userInfo": {"displayName": nameText.text}
      };