Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combining multiple different flutter projects

So I have received a project which requires e-commerce, food ordering and car hailing services like Grab to be inside one app. I have delivered all these 3 apps in different projects before and for this new project I'm wondering whether it is possible to combine all my previous source code into one project, running on different dependencies.

like image 219
emily Avatar asked May 25 '26 19:05

emily


1 Answers

You can create packages for all 3 modules (food, e-commerce, car-hailing services)

To create a Flutter package, use the --template=package flag with flutter create:

flutter create --template=package food

Folder Structure

lib
packages
  - food
  - e_commerce
  - car_hailing_service

Import this in the main module's pubspec.yaml file

dependencies:
flutter:
  sdk: flutter

# My Custom Packages
food:
  path: packages/food
e_commerce:
  path: packages/e_commerce
car_hailing_service:
  path: packages/car_hailing_service

If you have any common functionalities for all 3 packages then create a separate package for that also and import that common package for all 3 packages.

Refer to this document for creating flutter packages. I hope this helps you.

like image 154
Vinoth Vino Avatar answered May 27 '26 07:05

Vinoth Vino