Old projects with error after Flutter update

Asked

Viewed 567 times

-1

A Flutter update was made using the command: git clone -b stable https://github.com/flutter/flutter.git

After this update, some old projects have several bugs (here are some of them):

List _toDoList = [];

Missing type argument for list literal. Try Adding an Explicit type like 'Dynamic', or enable implicit-Dynamic in your analysis options file.

  setState(() {
    _toDoList = json.decode(data);
  });

A value of type 'Dynamic' can’t be Assigned to a variable of type 'List'. Try Changing the type of the variable, or casting the right-hand type to 'List'.

Map<String, dynamic> newToDo = Map();

Missing type Arguments for Generic type 'Map'. Try Adding an Explicit type like 'Dynamic', or enable implicit-Dynamic in your analysis options file.

title: Text(_toDoList[index]["title"]),
value: _toDoList[index]["ok"],

The argument type 'Dynamic' can’t be Assigned to the Parameter type 'String'.


I even executed the following commands:

Flutter clean / Flutter pub cache repair / Flutter pub pub cache repair

But the mistakes remain

flutter doctor -v [ ] Flutter (Channel stable, v1.12.13+Hotfix.9, on Microsoft Windows [version 10.0.18363.815], locale en-BR) • Flutter version 1.12.13+Hotfix.9 at D: Desenv flutter • Framework Revision f139b11009 (4 Weeks ago), 2020-03-30 13:57:30 -0700 • Engine Revision af51afceb8 • Dart version 2.7.2

[] Android toolchain - develop for Android Devices (Android SDK version 29.0.3) • Android SDK at D: Desenv SDK • Android NDK Location not configured (optional; Useful for Native Profiling support) • Platform android-29, build-tools 29.0.3 • ANDROID_HOME = D: Desenv SDK • Java Binary at: D: Program Files Android Studio jre bin java • Java version Openjdk Runtime Environment (build 1.8.0_212-release-1586-b04) • All Android licenses accepted.

[] Android Studio (version 3.6) • Android Studio at D: Program Files Android Android Studio • Flutter plugin version 45.1.1 • Dart plugin version 192.7761 • Java version Openjdk Runtime Environment (build 1.8.0_212-release-1586-b04)

[] Connected device (1 available) • Android SDK built for x86 • Emulator-5554 • android-x86 • Android 10 (API 29) (Emulator)

• No issues found!

1 answer

0

To help people who, like me, are starting out in development and in Flutter. For correction of reported errors, I have performed the following procedure.

  1. I uninstalled Vscode and Android Studio.
  2. Delete the following folders (when uninstalling they remain): C: Users user.android C: User Users.Androidstudio3.6 C: Users user.vscode C: Users user Appdata Roaming.Dart C: Users user Appdata Roaming Code C: Users user Appdata Roaming Code C: Users user Appdata Roaming Code
  3. Deletes the Flutter installation folder
  4. I downloaded version v1.12.13+Hotfix.8 of Flutter
  5. I downloaded again the updated version of Vscode and Strudio Android
  6. I installed Flutter following the official documentation, including the Android SDK Tools option (Obsolete)
  7. After all settings, I created a new project with the same name as the old project
  8. I only copied the files from the LIB folder and the files from the Assets folder
  9. I executed the commands: flutter pub get and flutter clean.

There were more informative of no errors in the projects, I did this with all the projects that I had without problems.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.