Flutterando / modular

A smart project structure
https://pub.dev/packages/flutter_modular
Other
1.31k stars 255 forks source link

modular_app.dart:156:31: Error: The argument type 'Widget' can't be assigned to the parameter type 'InheritedWidget'. #668

Closed insinfo closed 2 years ago

insinfo commented 2 years ago

i am getting this error in flutter 2.11

/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_modular-4.5.0/lib/src/presenter/widgets/modular_app.dart:156:31: Error: The argument type 'Widget' can't be assigned to the parameter type 'InheritedWidget'.
 - 'Widget' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
 - 'InheritedWidget' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
    if (_dirty) notifyClients(widget);
                              ^

flutter doctor -v

PS C:\MyDartProjects\riodasostras\riodasostrasapp_mob> flutter doctor -v
[√] Flutter (Channel master, 2.11.0-0.0.pre.653, on Microsoft Windows [versão 10.0.22000.493], locale pt-BR)
    • Flutter version 2.11.0-0.0.pre.653 at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 922bbfeed7 (2 hours ago), 2022-02-23 17:54:21 +0530
    • Engine revision 258e7ff9c3
    • Dart version 2.17.0 (build 2.17.0-138.0.dev)
    • DevTools version 2.11.0

[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at C:\Users\isaque\AppData\Local\Android\sdk
    • Platform android-32, build-tools 32.0.0
    • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.3)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.31702.278
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2020.3)
    • Android Studio at C:\Program Files\Android\Android Studio1
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[√] VS Code (version 1.64.2)
    • VS Code at C:\Users\isaque\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.34.0

[√] Connected device (4 available)
    • SM G780G (mobile) • RQ8R7080W4V • android-arm64  • Android 12 (API 31)
    • Windows (desktop) • windows     • windows-x64    • Microsoft Windows [versão 10.0.22000.493]
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 98.0.4758.82
    • Edge (web)        • edge        • web-javascript • Microsoft Edge 98.0.1108.43

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
PS C:\MyDartProjects\riodasostras\riodasostrasapp_mob> 

pubspec.yaml

name: riodasostrasapp
description: App Oficial da Prefeitura de Rio das Ostras
version: 2.0.1+7
publish_to: none
environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  #para o Quiz
  font_awesome_flutter: ^9.2.0 #Null safety full
  flutter_custom_clippers: ^2.0.0 #Null safety full
  html_unescape: ^2.0.0 #Null safety full
  auto_size_text: ^3.0.0 #Null safety full
  connectivity_plus: ^2.1.0 #Null safety full
  url_launcher: ^6.0.17 #Null safety full
  share_plus: ^3.0.4 #Null safety share_plus
  map_launcher: ^2.1.1 #Null safety 
  platform_device_id: ^1.0.1 #Null safety full
  #location_permissions: ^4.0.1  # foi substituído pelo permission_handler 8.3.0  #Null safety
  location: ^4.3.0 #Null safety
  flutter_inappwebview: ^5.3.2 #Null safety  
  firebase_messaging: ^11.2.4 #Null safety  

  path_provider: ^2.0.8 #Null safety
  flutter_advanced_networkimage_2: ^2.0.0 #Null safety full
  cached_network_image: ^3.2.0 #Null safety 
  webview_flutter: ^3.0.0 #Null safety 
  flutter_map: ^0.14.0 #Null safety full
  latlong2: ^0.8.1 #Null safety full
 # queries: ^0.1.15 
  collection: ^1.15.0 #Null safety
  intl: ^0.17.0 #Null safety full
  #universal_html: ^2.0.8 #Null safety full

  #wideget para infinit scroll
  incrementally_loading_listview: ^1.0.0 #Null safety
  infinite_scroll_pagination: ^3.1.0  #Null safety
  mobx: any
  flutter_mobx: any 
  provider: ^6.0.1 #Null safety full  
  flutter_modular: ^4.5.0  #Null safety full
  equatable: ^2.0.3 #Null safety full
  carousel_slider: ^4.0.0 #Null safety full
  #para armazenar o token  
  #flutter_secure_storage: ^5.0.2 #Null safety full 
  #sqflite: ^2.0.1 #Null safety 
  shared_preferences: ^2.0.12 #Null safety full
  jaguar_jwt: ^3.0.0 #Null safety
  barcode_scan2: ^4.2.0  #Null safety full
  #gerar codigo qr
  #qr_flutter: ^4.0.0  # Null safety full     
  pdf: ^3.6.5 #Null safety full
  qr: ^3.0.0 #Null safety full

  webview_windows: 0.1.0 #Null safety
  printing: ^5.7.2 #Null safety full
  #native_pdf_view: ^5.0.0 #Null safety renamed to pdfx
  #pdfx: ^2.0.1+1
  syncfusion_flutter_pdfviewer:
    path: ../../flutter_pdf/flutter_pdfviewer

  encrypt: ^5.0.1 #Null safety
  get: ^4.3.8 #Null safety
  scroll_to_index: ^2.1.0 #Null safety
  modern_form_esys_flutter_share: ^1.1.2 #Null safety
  badges: ^2.0.2 #Null safety

  riodasostrasapp_core:
    path: ../riodasostrasapp_core
   # hosted:
   #   name: riodasostrasapp_core
   #   url: http://pub.riodasostras.rj.gov.br:4000
   # version: ^1.0.39

  #video playback
  #dart_vlc: ^0.1.8 
  #video_player: ^2.2.14
  video_player: ^2.1.1
  video_player_windows:
    #git:
      #url: https://github.com/anirudhb/flutter_packages.git
      #path: video_player_windows
    path: ../../flutter_packages/video_player_windows      
  http: ^0.13.4 #Null safety full
  dio: ^4.0.4 #Null safety full  
  dio_http_cache: #^0.3.0 #Null safety
    path: ../../dio-http-cache

dependency_overrides:
  rxdart: ^0.27.3 #Null safety full  

dev_dependencies:
#  flutter_test:
#    sdk: flutter
#  mockito: ^4.1.1
  build_runner: ^2.1.7 #Null safety
  mobx_codegen: ^2.0.4 #Null safety
  slidy: ^3.2.2+2 #Null safety full

flutter:
  uses-material-design: true

  assets:
    - assets/images/

  fonts:
    - family: Poppins
      fonts:
        - asset: assets/fonts/Poppins/Poppins-Regular.ttf
        - asset: assets/fonts/Poppins/Poppins-Medium.ttf
          weight: 600
        - asset: assets/fonts/Poppins/Poppins-Bold.ttf
          weight: 700
    - family: Montserrat
      fonts:
        - asset: assets/fonts/Montserrat/Montserrat-Regular.ttf
        - asset: assets/fonts/Montserrat/Montserrat-Medium.ttf
          weight: 600
        - asset: assets/fonts/Montserrat/Montserrat-Bold.ttf
          weight: 700      
    - family: pmro_app
      fonts:
        - asset: assets/fonts/pmro.ttf     

    - family: pictogramas_turismo
      fonts:
        - asset: assets/fonts/pictogramas_turismo.ttf   

scripts:
  mobx: flutter pub run build_runner watch --delete-conflicting-outputs
AlvaroVasconcelos commented 2 years ago

Hi, could you give us an example for the error?

insinfo commented 2 years ago

It does not compile anymore because there was a breaking change in Flutter.

Getting the widget of an Element is now a Widget instead of a InheritedWidget, because it is a performance issue.

Because of that change, it won't compile here anymore:

It should be Widget instead.

Change on Flutter side is here

juicycleff commented 2 years ago

Having similar error

icfilho commented 2 years ago

same error here.

Zeca-dev commented 2 years ago

same error too.

Bwolfs2 commented 2 years ago

Just run on the Stable Version of Flutter

jacobaraujo7 commented 2 years ago

Fixed. Coming soon in Modular v5

nejat-njonjo commented 2 years ago

When is the release date? v5

jacobaraujo7 commented 2 years ago

When is the release date? v5

This week!