How do I know which Flutter version to use for an existing project?

I just cloned a repository of a Flutter project and I don’t know which flutter sdk version should I use. I tried with 5-6 version and every one of them threw an error (errors like “this function doesn’t exist” or something like that.

I use the version 3.18.0-0.1.pre (since it says that in the pubspec.lock at the end, and with that version I was able to run the project, but I had to change the version of the package intl since it threw an error saying this:

Note: intl is pinned to version 0.18.1 by flutter_localizations from the flutter SDK.
See https://dart.dev/go/sdk-version-pinning for details.
2

Because every version of flutter_localizations from sdk depends on intl 0.18.1 and evita_mobile depends on intl ^0.19.0, flutter_localizations from sdk is forbidden.
So, because evita_mobile depends on flutter_localizations from sdk, version solving failed.

I was able to run the project, but it doesn’t work like it should (I wasn’t able to get past the login page, since the functions to authenticate the user don’t work). I think this is because it changed a lot of things in the pubspec.lock

At the moment, I don’t know if the problem is the version of Flutter, but this is my theory, since the previous programmer who left the company was able to run the project without problems.

I already tried a lot of terminal codes like flutter pub get, flutter pub outdated, flutter pub upgrade, flutter pub upgrade –major-versions and so more.

I will drop the pubspec.yaml here because I think it’s important:

name: evita_mobile
description: A new Flutter project.

version: 1.0.0+1

environment:
  sdk: ">=2.19.2 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  http: ^0.13.4
  shared_preferences: ^2.0.15
  intl: ^0.19.0
  flutter_html: ^3.0.0-alpha.6
  encrypt: ^5.0.1
  file_picker: ^5.2.6
  mime: ^1.0.4
  path_provider: ^2.0.14
  syncfusion_flutter_pdfviewer: ^21.2.3
  flutter_barcode_scanner: ^2.0.0
  chewie_audio: ^1.5.0
  flutter_localizations:
    sdk: flutter
  dots_indicator: ^3.0.0
  font_awesome_flutter: ^10.5.0
  url_launcher: ^6.0.12
  table_calendar: ^3.0.9
  flutter_launcher_icons: ^0.13.1
  flutter_local_notifications: ^9.0.0
  permission_handler: ^10.4.5
  workmanager: ^0.5.2
  flutter_secure_storage: ^8.1.0
  flutter_inappwebview: ^5.5.0+5
  infinite_scroll_pagination: ^4.0.0

flutter_icons:
  image_path: "lib/images/evita_logo.png"
  android: true
  ios: true

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0

flutter:
  uses-material-design: true
  assets:
    - lib/images/

New contributor

Andres Oliveira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

If you can open the pubspec.lock file you will be able to see the flutter and dart version at the bottom of file. There you can compare it with your’s version.

Remove dependency issues you can check for outdated packages in pubspec.yaml file or by running command in Terminal. And then run flutter pub upgrade --major-versions to upgrade the packages to latest relevant versions. It may help to sort your issue.

What it seems to happen here, is that your project is not updated with the latest Flutter version.

Yes, you could manage and run it by finding the Flutter version you need to use by going to the pubspec.lock (as written by the other answer here), but I would recomment you to take the time and slowly upgrade the project.

If not, sooner or later you will need to continuously change Flutter versions between different projects, or be forced to update by either Flutter or a Package.

If it’s just one file as the above, and the dev of the package has not updated in months, either find another package, or you could fork it and update it yourself (and import your version as package). But before doing that, do read the bellow because forking and using your own package is like the last solution you should go for.

Oh and also very important: do not edit manually your pubspec.lock!!! It’s an auto generated file.

How to update your Flutter project

Upgrate Flutter and Packages versions

What updating the project means, is to have your Flutter and packages versions to their newest, compatible with each other, versions. To do that, you need to upgrade your Flutter version to the latest stable one, and then all your packages to their newest version on their package page.

Resolve Packages conflicts

Then there are two scenarios, either pub get will run smoothly, or you’ll get an error as the above you write – but for in-between packages. Then you’ll have to downgrade the package with the larger version at the error, and continue this process till pub get runs correctly. Quite a hideous process, but necessary – and it can get a bit advanced if the project is too old.

Resolve Flutter code conflicts

Then, if pub get runs without issues, you will need to resolve code conflicts. As you mentioned above, you got errors like “this function does not exists” – I suspect that was because your project has such an older version of Flutter that it uses now depricated functions.

What you need to do in this situation, is to search each different function to google asking with which flutter function it has been replaced – and use that one.

It can be scary to make such changes if you are new to Flutter, but if you take it slow and steady, you have nothing to be afraid so.

That’s it!

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật