0

We enabled our flutter application for web but we are getting some import errors. All the imports are valid and working in Android so Im not seeing what the issue is.

I researched this particular import and learned that it is caused by having multiple main()'s in the app but the other ones are valid.

import 'generated_plugin_registrant.dart'; from lbconnect_web|lib/screens/member/test_web_entrypoint.dart at 5:1

There are 10 other import errors for packages that do not appear to have any issues.

these are the others and there are multiple errors on each:

import 'package:lbconnect_web/models/checkin_model.dart'; from lbconnect_web|lib/modules/check_in_question.dart at 4:1 import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart';

checkin_model is just a class for one variable and cupertino_settings is in my pubspec.yaml as

flutter_cupertino_settings: ^0.0.9+1

EDIT 3 - ERROR

Unable to find modules for some sources, this is usually the result of either a bad import, a missing dependency in a package (or possibly a dev_dependency
needs to move to a real dependency), or a build failure (if importing a
generated file).

Please check the following imports:

import 'package:lbconnect_web/models/checkin_model.dart'; from lbconnect_web|lib/screens/member/EmotionalWheel/choose.dart at 8:1 import 'package:lbconnect_web/models/checkin_model.dart'; from lbconnect_web|lib/modules/check_in_question.dart at 4:1 import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart'; from lbconnect_web|lib/screens/member/settings_2.0/widgets/selection_fields/card_settings_multiselect.dart at 8:1 import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart'; from lbconnect_web|lib/screens/member/settings_2.0/widgets/text_fields/card_settings_text.dart at 7:1 import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart'; from lbconnect_web|lib/screens/member/settings_2.0/widgets/numeric_fields/card_settings_switch.dart at 8:1 import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart'; from lbconnect_web|lib/screens/member/settings_2.0/widgets/picker_fields/card_settings_time_picker.dart at 8:1 import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart'; from lbconnect_web|lib/screens/member/settings_2.0/widgets/picker_fields/card_settings_color_picker.dart at 9:1 import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart'; from lbconnect_web|lib/screens/member/settings_2.0/widgets/picker_fields/card_settings_date_picker.dart at 8:1 import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart'; from lbconnect_web|lib/screens/member/settings_2.0/widgets/numeric_fields/card_settings_slider.dart at 8:1 import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart'; from lbconnect_web|lib/screens/member/settings_2.0/widgets/picker_fields/card_settings_list_picker.dart at 8:1 import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart'; from lbconnect_web|lib/screens/member/settings_2.0/widgets/card_settings_panel.dart at 7:1
import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart'; from lbconnect_web|lib/screens/member/settings_2.0/widgets/information_fields/card_settings_header.dart at 7:1 import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart'; from lbconnect_web|lib/screens/member/settings_2.0/widgets/information_fields/card_settings_instructions.dart at 6:1 import 'package:flutter_cupertino_settings/flutter_cupertino_settings.dart'; from lbconnect_web|lib/screens/member/settings_2.0/widgets/action_fields/card_settings_button.dart at 4:1

Unable to find modules for some sources, this is usually the result of either a bad import, a missing dependency in a package (or possibly a dev_dependency needs to move to a real dependency), or a build failure (if importing a generated file).

Please check the following imports:

import 'generated_plugin_registrant.dart'; from lbconnect_web|lib/screens/member/test_web_entrypoint.dart at 5:1

Failed after 655ms Building application for the web... 31.1s Failed to build application for the Web.

EDIT 2 - CHECKINMODEL

 class CheckInModel {
  String checkInId;


  CheckInModel({this.checkInId});

  factory CheckInModel.fromJson(Map<String, dynamic> json) {
    return CheckInModel(
      checkInId: json['CheckInID'],

   );
 }

}

EDIT

PACKAGES in YAML

    dependencies:
     flutter:
      sdk: flutter

     # The following adds the Cupertino Icons font to your application.
     # Use with the CupertinoIcons class for iOS style icons.
       cupertino_icons: ^0.1.2
       rxdart: ^0.22.0
      provider: ^3.0.0+1
      shared_preferences: 0.5.2
      flutter_local_notifications:

       dev_dependencies:
        flutter_test:
         sdk: flutter

      flutter_redux: ^0.5.2
     snaplist: ^0.1.3
      font_awesome_flutter: ^8.0.1
     http: ^0.12.0
     intl: ^0.15.7
    device_calendar: ^0.0.7
    dynamic_theme:
     eva_icons_flutter:
     flutter_speed_dial:
        sqflite:
         url_launcher: ^5.0.3
      swipedetector: ^1.2.0
        contacts_service: ^0.2.1
        agora_rtc_engine: 1.0.5
           permission_handler: ^3.0.0
       validators: ^2.0.0
      path_provider: ^1.1.0
     share_extend: ^1.0.9
        shimmer: ^1.0.0
       flutter_launcher_icons: ^0.7.2
        flutter_tableview:
        flutter_masked_text: ^0.8.0
          flutter_colorpicker: ^0.2.6
        meta: ^1.1.6
       auto_size_text: ^1.0.0
        flutter_email_sender: ^2.0.3
        fl_chart: ^0.2.0
      flutter_sms: ^1.0.1
      firebase_messaging: ^5.1.1
         image_picker: 0.6.0+17
      carousel_slider: ^1.3.0
      sliding_up_panel:
        scoped_model: ^1.0.1
           awesome_dialog: ^0.0.4

     flutter_icons:
    android: "launcher_icon" 
     ios: false
     image_path: "assets/logo/ic_launcher.png"

     flutter_email_sender:
      path: ../

      flutter_cupertino_settings: ^0.0.9+1
Sam Cromer
  • 2,063
  • 10
  • 28
  • 50

1 Answers1

0

The reason for your errors is most probably because there may be packages that do not have native implementation for web and but only for android / ios . That is also the rsn why your app is running fine on android. The official packages developed by flutter are almost all supported on web. (there may still be some exceptions). To run your app on web you'll have to check each package if they are having support for web.

Aman Malhotra
  • 3,068
  • 2
  • 18
  • 28