Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

376
Views
How do I create a pub package that works with Flutter?

pub is Dart's package manager. Flutter is a mobile app SDK that uses Dart. How can I create a package that depends on, or targets, Flutter?

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

To declare a dependency on Flutter, from a pub package, add this to your pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter

You must use flutter packages get instead of pub get, because Flutter needs to set the appropriate environment variables to map the sdk: flutter to a location.

To easily and quickly create a new pub package, use the stagehand tool. After you install stagehand, follow these instructions:

$ mkdir fancy_project
$ cd fancy_project
$ stagehand package-simple

After you create your new package, edit the pubspec.yaml and add the sdk:flutter as shown above.

about 4 years ago · Santiago Trujillo Report

0

A trick I also use is to just flutter create foo (which creates a full-fledged Flutter app, more than you need) and then rm -rf foo/ios foo/android and edit/remove foo/lib/main.dart, etc.

The stagehand solution from @sethladd is more elegant, but requires having installed stagehand.

about 4 years ago · Santiago Trujillo Report

0

flutter create now supports templates. The package template creates exactly that:

flutter create -t package

or to create a plugin that depends on platform-specific code:

flutter create -t plugin
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!