text
stringlengths
1
372
<topic_end>
<topic_start>
what’s in the flutter SDK
the following is available through the flutter SDK:
note: for more information about the flutter SDK, see its
README file.
<topic_end>
<topic_start>
flutter command-line tool
the flutter CLI tool (flutter/bin/flutter) is how developers
(or IDEs on behalf of developers) interact with flutter.
<topic_end>
<topic_start>
dart command-line tool
the dart CLI tool is available with the flutter SDK at flutter/bin/dart.
<topic_end>
<topic_start>
flutter and the pubspec file
info note
this page is primarily aimed at folks who write
flutter apps. if you write packages or plugins,
(perhaps you want to create a federated plugin),
you should check out the
developing packages and plugins page.
every flutter project includes a pubspec.yaml file,
often referred to as the pubspec.
a basic pubspec is generated when you create
a new flutter project. it’s located at the top
of the project tree and contains metadata about
the project that the dart and flutter tooling
needs to know. the pubspec is written in
YAML, which is human readable, but be aware
that white space (tabs v spaces) matters.
the pubspec file specifies dependencies
that the project requires, such as particular packages
(and their versions), fonts, or image files.
it also specifies other requirements, such as
dependencies on developer packages (like
testing or mocking packages), or particular
constraints on the version of the flutter SDK.
fields common to both dart and flutter projects
are described in the pubspec file on dart.dev.
this page lists flutter-specific fields
that are only valid for a flutter project.
info note
the first time you build your project, it
creates a pubspec.lock file that contains
specific versions of the included packages.
this ensures that you get the same version
the next time the project is built.
when you create a new project with the
flutter create command (or by using the
equivalent button in your IDE), it creates
a pubspec for a basic flutter app.
here is an example of a flutter project pubspec file.
the flutter only fields are highlighted.
<topic_end>
<topic_start>
assets
common types of assets include static data
(for example, JSON files), configuration files,
icons, and images (jpeg, WebP, GIF,
animated WebP/GIF, PNG, BMP, and WBMP).
besides listing the images that are included in the
app package, an image asset can also refer to one or more
resolution-specific “variants”. for more information,
see the resolution aware section of the
assets and images page.
for information on adding assets from package
dependencies, see the
asset images in package dependencies
section in the same page.
<topic_end>
<topic_start>
fonts
as shown in the above example,
each entry in the fonts section should have a
family key with the font family name,
and a fonts key with a list specifying the
asset and other descriptors for the font.
for examples of using fonts
see the use a custom font and
export fonts from a package recipes in the
flutter cookbook.
<topic_end>
<topic_start>
more information
for more information on packages, plugins,
and pubspec files, see the following:
<topic_end>
<topic_start>
flutter fix
as flutter continues to evolve, we provide a tool to help you clean up
deprecated APIs from your codebase. the tool ships as part of flutter, and
suggests changes that you might want to make to your code. the tool is available
from the command line, and is also integrated into the IDE plugins for android
studio and visual studio code.
lightbulb tip
these automated updates are called quick-fixes in IntelliJ and android
studio, and code actions in VS code.