---
# System prepended metadata

title: Untitled

---

**Flutter** 

- Requirements:
    - To develop Flutter apps for iOS, you need to have Xcode installed (it has an iOS simulator) 
        - Go to https://developer.apple.com/xcode/ and download xcode with App Store
        - Open Xcode to finish the installation 
        - Verify the installation opening the simulator using cmd+space:  simultator 
    - Get the Flutter SDK:
        -  download flutter from: https://storage.googleapis.com/flutter_infra/releases/stable/macos/flutter_macos_v1.12.13+hotfix.9-stable.zip
        - Copy the unzip folder to your home directory, then add the flutter tool to your path (`$ code ~./bash_profile`, add `export PATH=$PATH:$HOME/flutter/bin`) 
        - For VSCode: install the flutter extension
        - If you are using Catalina iOS, go to: System Preferences -> Security & Privacy -> General, and allow "idevice_id"
        - Note: if you run `$ flutter doctor` and XCode is unchecked, run `$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Develope` and `$ sudo xcodebuild -runFirstLaunch`. Then run `$ sudo xcodebuild -license` to accept the license agreement
- IDE:
    - Using Android Studio (platform to run flutter) (can be used on Mac, linux) (Free)
        - Install Android Studio
        - Install flutter and Dart plugins (plugins tab in Android Studio): if plugins not available, download and install flutter sdk 
        - Before run the app we have to create a virtual device, the run the app (we have to set up hardware, API level (27 recomended) (try different screen sizes, etc))
        - Then we can run apps in the device
    - Using VS Code. 
        - iOS simulator: open the xcode simulador, and open in vscode
        - Android simulator: (You don't need Android Studio to create or run a Virtual Device).  Just use `sdkmanager` and `avdmanager` from the android sdk tools. Set up x86 emulator in android studio on the iMac. From visual studio code using the bash terminal find the x86 emulators setup with the command `"/Users/your_user/Library/android/sdk/emulator/emulator -list-avds"` and manually launch the emulator using `"emulator -avd the_device_name"`. Setting the path in `etc/paths` will allow you to find the emulator.
- To create a new project type `$ flutter create dir/new_proyect_name`
    - To check dependencies run `$ flutter doctor`
    - For vscode open the iOS simulator installed with xcode and vscode run the app  
- Compiling: how to compile for android and iOS on Mac, LINUX, etc (build the engine used by `flutter run`):
	- https://github.com/flutter/flutter/wiki/Compiling-the-engine#compiling-for-android-from-macos-or-linux

- Build and release an Android app:
	- When a new Flutter app is created, it has a default launcher icon.
	- To publish on the Play Store, you need to give your app a digital signature (instructions to sign your app: https://flutter.dev/docs/deployment/android)
	- You have two possible release formats when publishing to the Play Store:
	    - App bundle: (preferred)(The Android App Bundle is Android's new, official publishing format that offers a more efficient way to build and release your app.)
    	- APK
	- Test the app bundle:
		- Offline using the bundle tool:
    		- If you haven’t done so already, download bundletool from the GitHub repository.
    		- Generate a set of APKs from your app bundle.
   	 	    - Deploy the APKs to connected devices
	- Continuous deployment: There is a guide about how to integrate `fastlane` (an open-source tool suite, with your existing testing and continuous integration (CI) workflows, eg:Travis)
- User interface:
	- You build your UI out of widgets(widget catalog: https://flutter.dev/docs/development/ui/widgets)
	- The core of Flutter’s layout mechanism is widgets (almost everything is a widget—even layout models are widgets. Images, icons, and text are all widgets)
	- You create a layout by composing widgets to build more complex widgets
	- When the state of your app changes (for example, the user flips a switch in the settings screen), you change the state, and that triggers a redraw of the user interface.
	- Page navigation: 
		- Flutter provides the navigation patterns seen on Android and iOS and also automatically adapts the navigation animation to the current platform
			- On Android, two page transition animation styles exist depending on your OS version:
    			- Pre API 28 uses a bottom-up animation that slides up and fades in.
    			- On API 28 and later, the bottom-up animation slides and clip-reveals up.
			- On iOS when the push style transition is used
	- Backnavigation: 
		- On Android, the OS back button, by default.
		- On iOS, an edge swipe gesture can be used to pop the top route.
	- Scrolling: Flutter automatically adjusts the scrolling behavior to match the current platform.
	- Return to top: On iOS, tapping the OS status bar scrolls the primary scroll controller to the top position. There is no equivalent behavior on Android.

- Data and backend 
	- Networking: The `http` package provides the simplest way to issue http requests. This package is supported on Android, iOS, and the web.
	    - Make authenticated requests: The most common uses the `Authorization HTTP` header. (Steps: https://flutter.dev/docs/cookbook/networking/authenticated-requests)
		- Fetch data (Steps : https://flutter.dev/docs/cookbook/networking/fetch-data)
		- Send data (Steps: https://flutter.dev/docs/cookbook/networking/send-data)
	- SQLite databases: Flutter apps can make use of the SQLite databases via the `sqflite` plugin available on pub.
		- Persist data with SQLite: Add the dependencies, open  and work with the database: https://flutter.dev/docs/cookbook/persistence/sqlite
	- JSON and serialization: https://flutter.dev/docs/development/data-and-backend/json 
	

