text
stringlengths 1
474
|
---|
int counter = (prefs.getInt('counter') ?? 0) + 1;
|
await prefs.setInt('counter', counter);
|
}<code_end>
|
<topic_end>
|
<topic_start>
|
How do I access SQLite in Flutter?
|
In Android, you use SQLite to store structured data
|
that you can query using SQL.In Flutter, for macOS, Android, or iOS,
|
access this functionality using the
|
SQFlite plugin.<topic_end>
|
<topic_start>
|
Debugging
|
<topic_end>
|
<topic_start>
|
What tools can I use to debug my app in Flutter?
|
Use the DevTools suite for debugging Flutter or Dart apps.DevTools includes support for profiling, examining the heap,
|
inspecting the widget tree, logging diagnostics, debugging,
|
observing executed lines of code, debugging memory leaks and memory
|
fragmentation. For more information, see the
|
DevTools documentation.<topic_end>
|
<topic_start>
|
Notifications
|
<topic_end>
|
<topic_start>
|
How do I set up push notifications?
|
In Android, you use Firebase Cloud Messaging to set up
|
push notifications for your app.In Flutter, access this functionality using the
|
Firebase Messaging plugin.
|
For more information on using the Firebase Cloud Messaging API,
|
see the firebase_messaging plugin documentation.
|
<topic_end>
|
<topic_start>Flutter for SwiftUI Developers
|
SwiftUI developers who want to write mobile apps using Flutter
|
should review this guide.
|
It explains how to apply existing SwiftUI knowledge to Flutter.info Note
|
If you instead have experience building apps for iOS with UIKit,
|
see Flutter for UIKit developers.Flutter is a framework for building cross-platform applications
|
that uses the Dart programming language.
|
To understand some differences between programming with Dart
|
and programming with Swift, see Learning Dart as a Swift Developer
|
and Flutter concurrency for Swift developers.Your SwiftUI knowledge and experience
|
are highly valuable when building with Flutter.Flutter also makes a number of adaptations
|
to app behavior when running on iOS and macOS.
|
To learn how, see Platform adaptations.info
|
To integrate Flutter code into an existing iOS app,
|
check out Add Flutter to existing app.This document can be used as a cookbook by jumping around
|
and finding questions that are most relevant to your needs.
|
This guide embeds sample code.
|
You can test full working examples on DartPad or view them on GitHub.<topic_end>
|
<topic_start>
|
Overview
|
As an introduction, watch the following video.
|
It outlines how Flutter works on iOS and how to use Flutter to build iOS apps.Flutter and SwiftUI code describes how the UI looks and works.
|
Developers call this type of code a declarative framework.<topic_end>
|
<topic_start>
|
Views vs. Widgets
|
SwiftUI represents UI components as views.
|
You configure views using modifiers.Flutter represents UI components as widgets.Both views and widgets only exist until they need to be changed.
|
These languages call this property immutability.
|
SwiftUI represents a UI component property as a View modifier.
|
By contrast, Flutter uses widgets for both UI components and
|
their properties.To compose layouts, both SwiftUI and Flutter nest UI components
|
within one another.
|
SwiftUI nests Views while Flutter nests Widgets.<topic_end>
|
<topic_start>
|
Layout process
|
SwiftUI lays out views using the following process:Flutter differs somewhat with its process:Flutter differs from SwiftUI because the parent component can override
|
the child’s desired size. The widget cannot have any size it wants.
|
It also cannot know or decide its position on screen as its parent
|
makes that decision.To force a child widget to render at a specific size,
|
the parent must set tight constraints.
|
A constraint becomes tight when its constraint’s minimum size value
|
equals its maximum size value.In SwiftUI, views might expand to the available space or
|
limit their size to that of its content.
|
Flutter widgets behave in similar manner.However, in Flutter parent widgets can offer unbounded constraints.
|
Unbounded constraints set their maximum values to infinity.If the child expands and it has unbounded constraints,
|
Flutter returns an overflow warning:To learn how constraints work in Flutter,
|
see Understanding constraints.<topic_end>
|
<topic_start>
|
Design system
|
Because Flutter targets multiple platforms, your app doesn’t need
|
to conform to any design system.
|
Though this guide features Material widgets,
|
your Flutter app can use many different design systems:If you’re looking for a great reference app that features a
|
custom design system, check out Wonderous.<topic_end>
|
<topic_start>
|
UI Basics
|
This section covers the basics of UI development in
|
Flutter and how it compares to SwiftUI.
|
This includes how to start developing your app, display static text,
|
create buttons, react to on-press events, display lists, grids, and more.<topic_end>
|
<topic_start>
|
Getting started
|
In SwiftUI, you use App to start your app.Another common SwiftUI practice places the app body within a struct
|
that conforms to the View protocol as follows:To start your Flutter app, pass in an instance of your app to
|
the runApp function.
|
<code_start>void main() {
|
runApp(const MyApp());
|
}<code_end>
|
App is a widget. The build method describes the part of the
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.