├── .gitignore
├── Cover image.png
├── LICENSE
├── README.md
├── chapter_01
├── dummy_project
│ ├── .gitignore
│ ├── app
│ │ ├── .gitignore
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ ├── androidTest
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── myapplication
│ │ │ │ └── ExampleInstrumentedTest.java
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── myapplication
│ │ │ │ │ └── MainActivity.java
│ │ │ └── res
│ │ │ │ ├── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ │ ├── drawable
│ │ │ │ └── ic_launcher_background.xml
│ │ │ │ ├── layout
│ │ │ │ └── activity_main.xml
│ │ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ │ └── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── myapplication
│ │ │ └── ExampleUnitTest.java
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── hello_flutter
│ ├── .gitignore
│ ├── .metadata
│ ├── README.md
│ ├── android
│ │ ├── app
│ │ │ ├── build.gradle
│ │ │ └── src
│ │ │ │ ├── debug
│ │ │ │ └── AndroidManifest.xml
│ │ │ │ ├── main
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── java
│ │ │ │ │ └── com
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── hello_flutter
│ │ │ │ │ │ └── MainActivity.java
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ └── values
│ │ │ │ │ └── styles.xml
│ │ │ │ └── profile
│ │ │ │ └── AndroidManifest.xml
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ └── gradle-wrapper.properties
│ │ └── settings.gradle
│ ├── ios
│ │ ├── Flutter
│ │ │ ├── AppFrameworkInfo.plist
│ │ │ ├── Debug.xcconfig
│ │ │ └── Release.xcconfig
│ │ ├── Runner.xcodeproj
│ │ │ ├── project.pbxproj
│ │ │ ├── project.xcworkspace
│ │ │ │ └── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── xcschemes
│ │ │ │ └── Runner.xcscheme
│ │ ├── Runner.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── WorkspaceSettings.xcsettings
│ │ └── Runner
│ │ │ ├── AppDelegate.h
│ │ │ ├── AppDelegate.m
│ │ │ ├── Assets.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ │ ├── Icon-App-20x20@1x.png
│ │ │ │ ├── Icon-App-20x20@2x.png
│ │ │ │ ├── Icon-App-20x20@3x.png
│ │ │ │ ├── Icon-App-29x29@1x.png
│ │ │ │ ├── Icon-App-29x29@2x.png
│ │ │ │ ├── Icon-App-29x29@3x.png
│ │ │ │ ├── Icon-App-40x40@1x.png
│ │ │ │ ├── Icon-App-40x40@2x.png
│ │ │ │ ├── Icon-App-40x40@3x.png
│ │ │ │ ├── Icon-App-60x60@2x.png
│ │ │ │ ├── Icon-App-60x60@3x.png
│ │ │ │ ├── Icon-App-76x76@1x.png
│ │ │ │ ├── Icon-App-76x76@2x.png
│ │ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ │ └── LaunchImage.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchImage.png
│ │ │ │ ├── LaunchImage@2x.png
│ │ │ │ ├── LaunchImage@3x.png
│ │ │ │ └── README.md
│ │ │ ├── Base.lproj
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ │ ├── Info.plist
│ │ │ └── main.m
│ ├── lib
│ │ └── main.dart
│ ├── pubspec.lock
│ └── pubspec.yaml
└── hello_modern_languages
│ ├── .gitignore
│ ├── .metadata
│ ├── README.md
│ ├── android
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── hello_modern_languages
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── res
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ │ └── profile
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ └── settings.gradle
│ ├── ios
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── Runner-Bridging-Header.h
│ ├── lib
│ └── main.dart
│ ├── pubspec.lock
│ ├── pubspec.yaml
│ └── test
│ └── widget_test.dart
├── chapter_02
├── .gitignore
├── 02_introduction_to_dart.iml
├── CHANGELOG.md
├── README.md
├── analysis_options.yaml
├── bin
│ └── main.dart
├── lib
│ ├── 01-declaring_variables.dart
│ ├── 02-strings.dart
│ ├── 03-functions.dart
│ ├── 04-classes.dart
│ ├── 05-generics.dart
│ ├── 06-collections.dart
│ ├── 07-higher-order-functions.dart
│ ├── 08-cascade.dart
│ └── Builder.dart
└── pubspec.yaml
├── chapter_03
├── .gitignore
├── .metadata
├── README.md
├── assets
│ ├── LeckerliOne-Regular.ttf
│ ├── beach.jpg
│ ├── dog.jpg
│ ├── textiles.jpg
│ └── woman_shopping.jpg
├── lib
│ ├── basic_screen.dart
│ ├── immutable_widget.dart
│ ├── main.dart
│ └── text_layout.dart
├── pubspec.lock
└── pubspec.yaml
├── chapter_04
├── .gitignore
├── .metadata
├── README.md
├── lib
│ ├── deep_tree.dart
│ ├── e_commerce_screen_after.dart
│ ├── e_commerce_screen_before.dart
│ ├── flex_screen.dart
│ ├── profile_screen.dart
│ └── star.dart
├── pubspec.lock
└── pubspec.yaml
├── chapter_05
├── .gitignore
├── .metadata
├── README.md
├── lib
│ ├── login_screen.dart
│ ├── main.dart
│ ├── platform_alert.dart
│ └── stopwatch.dart
├── pubspec.lock
└── pubspec.yaml
├── chapter_06
├── lib
│ ├── controllers
│ │ └── plan_controller.dart
│ ├── main.dart
│ ├── models
│ │ ├── data_layer.dart
│ │ ├── plan.dart
│ │ └── task.dart
│ ├── plan_provider.dart
│ ├── repositories
│ │ ├── in_memory_cache.dart
│ │ └── repository.dart
│ ├── services
│ │ └── plan_services.dart
│ └── views
│ │ ├── plan_creator_screen.dart
│ │ └── plan_screen.dart
└── pubspec.yaml
├── chapter_07
├── lib
│ ├── generated_plugin_registrant.dart
│ ├── location_screen.dart
│ ├── main.dart
│ ├── navigation_dialog.dart
│ ├── navigation_first.dart
│ └── navigation_second.dart
└── pubspec.yaml
├── chapter_08
├── assets
│ └── pizzalist.json
├── lib
│ ├── generated_plugin_registrant.dart
│ ├── httphelper.dart
│ ├── main.dart
│ ├── pizza.dart
│ └── pizza_detail.dart
└── pubspec.yaml
├── chapter_09
├── chapter_9_a
│ ├── lib
│ │ ├── main.dart
│ │ └── stream.dart
│ └── pubspec.yaml
└── chapter_9_b
│ ├── lib
│ ├── countdown_bloc.dart
│ ├── main.dart
│ └── stream.dart
│ └── pubspec.yaml
├── chapter_10
├── lib
│ └── main.dart
└── pubspec.yaml
├── chapter_11
├── lib
│ ├── animatedlist.dart
│ ├── detail_screen.dart
│ ├── dismissible.dart
│ ├── fade_transition.dart
│ ├── list_screen.dart
│ ├── main.dart
│ ├── my_animation.dart
│ └── shape_animation.dart
└── pubspec.yaml
├── chapter_12
├── lib
│ ├── generated_plugin_registrant.dart
│ ├── happy_screen.dart
│ ├── login_screen.dart
│ ├── main.dart
│ ├── shared
│ │ └── firebase_authentication.dart
│ └── upload_file.dart
└── pubspec.yaml
├── chapter_13
├── lib
│ ├── camera.dart
│ ├── generated_plugin_registrant.dart
│ ├── language.dart
│ ├── main.dart
│ ├── ml.dart
│ ├── picture.dart
│ └── result.dart
└── pubspec.yaml
└── chapter_15
├── lib
├── .DS_Store
├── data
│ └── http_helper.dart
├── main.dart
├── models
│ └── book.dart
└── screens
│ └── book_list_screen.dart
└── pubspec.yaml
/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/.gitignore
--------------------------------------------------------------------------------
/Cover image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/Cover image.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Packt
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | buildToolsVersion "29.0.0"
6 | defaultConfig {
7 | applicationId "com.example.myapplication"
8 | minSdkVersion 15
9 | targetSdkVersion 28
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | implementation fileTree(dir: 'libs', include: ['*.jar'])
24 | implementation 'com.android.support:appcompat-v7:28.0.0'
25 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
26 | testImplementation 'junit:junit:4.12'
27 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
28 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
29 | }
30 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.myapplication;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.myapplication", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/java/com/example/myapplication/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.myapplication;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | public class MainActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_main);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/dummy_project/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/dummy_project/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/dummy_project/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/dummy_project/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/dummy_project/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/dummy_project/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/dummy_project/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/dummy_project/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/dummy_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/dummy_project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | My Application
3 |
4 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/app/src/test/java/com/example/myapplication/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.myapplication;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/chapter_01/dummy_project/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | google()
6 | jcenter()
7 |
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.4.1'
11 |
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | }
15 | }
16 |
17 | allprojects {
18 | repositories {
19 | google()
20 | jcenter()
21 |
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
15 |
16 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/dummy_project/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/chapter_01/dummy_project/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Jun 22 20:54:41 EDT 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/chapter_01/dummy_project/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # Visual Studio Code related
19 | .vscode/
20 |
21 | # Flutter/Dart/Pub related
22 | **/doc/api/
23 | .dart_tool/
24 | .flutter-plugins
25 | .packages
26 | .pub-cache/
27 | .pub/
28 | /build/
29 |
30 | # Android related
31 | **/android/**/gradle-wrapper.jar
32 | **/android/.gradle
33 | **/android/captures/
34 | **/android/gradlew
35 | **/android/gradlew.bat
36 | **/android/local.properties
37 | **/android/**/GeneratedPluginRegistrant.java
38 |
39 | # iOS/XCode related
40 | **/ios/**/*.mode1v3
41 | **/ios/**/*.mode2v3
42 | **/ios/**/*.moved-aside
43 | **/ios/**/*.pbxuser
44 | **/ios/**/*.perspectivev3
45 | **/ios/**/*sync/
46 | **/ios/**/.sconsign.dblite
47 | **/ios/**/.tags*
48 | **/ios/**/.vagrant/
49 | **/ios/**/DerivedData/
50 | **/ios/**/Icon?
51 | **/ios/**/Pods/
52 | **/ios/**/.symlinks/
53 | **/ios/**/profile
54 | **/ios/**/xcuserdata
55 | **/ios/.generated/
56 | **/ios/Flutter/App.framework
57 | **/ios/Flutter/Flutter.framework
58 | **/ios/Flutter/Generated.xcconfig
59 | **/ios/Flutter/app.flx
60 | **/ios/Flutter/app.zip
61 | **/ios/Flutter/flutter_assets/
62 | **/ios/ServiceDefinitions.json
63 | **/ios/Runner/GeneratedPluginRegistrant.*
64 |
65 | # Exceptions to above rules.
66 | !**/ios/**/default.mode1v3
67 | !**/ios/**/default.mode2v3
68 | !**/ios/**/default.pbxuser
69 | !**/ios/**/default.perspectivev3
70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
71 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/README.md:
--------------------------------------------------------------------------------
1 | # hello_flutter
2 |
3 | A new Flutter project.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13 |
14 | For help getting started with Flutter, view our
15 | [online documentation](https://flutter.dev/docs), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26 |
27 | android {
28 | compileSdkVersion 28
29 |
30 | lintOptions {
31 | disable 'InvalidPackage'
32 | }
33 |
34 | defaultConfig {
35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
36 | applicationId "com.example.hello_flutter"
37 | minSdkVersion 16
38 | targetSdkVersion 28
39 | versionCode flutterVersionCode.toInteger()
40 | versionName flutterVersionName
41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
42 | }
43 |
44 | buildTypes {
45 | release {
46 | // TODO: Add your own signing config for the release build.
47 | // Signing with the debug keys for now, so `flutter run --release` works.
48 | signingConfig signingConfigs.debug
49 | }
50 | }
51 | }
52 |
53 | flutter {
54 | source '../..'
55 | }
56 |
57 | dependencies {
58 | testImplementation 'junit:junit:4.12'
59 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
61 | }
62 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
9 |
13 |
20 |
24 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/app/src/main/java/com/example/hello_flutter/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.hello_flutter;
2 |
3 | import android.os.Bundle;
4 | import io.flutter.app.FlutterActivity;
5 | import io.flutter.plugins.GeneratedPluginRegistrant;
6 |
7 | public class MainActivity extends FlutterActivity {
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | GeneratedPluginRegistrant.registerWith(this);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:3.2.1'
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | google()
15 | jcenter()
16 | }
17 | }
18 |
19 | rootProject.buildDir = '../build'
20 | subprojects {
21 | project.buildDir = "${rootProject.buildDir}/${project.name}"
22 | }
23 | subprojects {
24 | project.evaluationDependsOn(':app')
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
7 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildSystemType
6 | Original
7 |
8 |
9 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : FlutterAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #include "AppDelegate.h"
2 | #include "GeneratedPluginRegistrant.h"
3 |
4 | @implementation AppDelegate
5 |
6 | - (BOOL)application:(UIApplication *)application
7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
8 | [GeneratedPluginRegistrant registerWithRegistry:self];
9 | // Override point for customization after application launch.
10 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
11 | }
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | hello_flutter
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/ios/Runner/main.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char* argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/chapter_01/hello_flutter/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: hello_flutter
2 | description: A new Flutter project.
3 |
4 | # The following defines the version and build number for your application.
5 | # A version number is three numbers separated by dots, like 1.2.43
6 | # followed by an optional build number separated by a +.
7 | # Both the version and the builder number may be overridden in flutter
8 | # build by specifying --build-name and --build-number, respectively.
9 | # In Android, build-name is used as versionName while build-number used as versionCode.
10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
12 | # Read more about iOS versioning at
13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
14 | version: 1.0.0+1
15 |
16 | environment:
17 | sdk: ">=2.1.0 <3.0.0"
18 |
19 | dependencies:
20 | flutter:
21 | sdk: flutter
22 |
23 | # The following adds the Cupertino Icons font to your application.
24 | # Use with the CupertinoIcons class for iOS style icons.
25 | cupertino_icons: ^0.1.2
26 |
27 | dev_dependencies:
28 | flutter_test:
29 | sdk: flutter
30 |
31 |
32 | # For information on the generic Dart part of this file, see the
33 | # following page: https://www.dartlang.org/tools/pub/pubspec
34 |
35 | # The following section is specific to Flutter.
36 | flutter:
37 |
38 | # The following line ensures that the Material Icons font is
39 | # included with your application, so that you can use the icons in
40 | # the material Icons class.
41 | uses-material-design: true
42 |
43 | # To add assets to your application, add an assets section, like this:
44 | # assets:
45 | # - images/a_dot_burr.jpeg
46 | # - images/a_dot_ham.jpeg
47 |
48 | # An image asset can refer to one or more resolution-specific "variants", see
49 | # https://flutter.dev/assets-and-images/#resolution-aware.
50 |
51 | # For details regarding adding assets from package dependencies, see
52 | # https://flutter.dev/assets-and-images/#from-packages
53 |
54 | # To add custom fonts to your application, add a fonts section here,
55 | # in this "flutter" section. Each entry in this list should have a
56 | # "family" key with the font family name, and a "fonts" key with a
57 | # list giving the asset and other descriptors for the font. For
58 | # example:
59 | # fonts:
60 | # - family: Schyler
61 | # fonts:
62 | # - asset: fonts/Schyler-Regular.ttf
63 | # - asset: fonts/Schyler-Italic.ttf
64 | # style: italic
65 | # - family: Trajan Pro
66 | # fonts:
67 | # - asset: fonts/TrajanPro.ttf
68 | # - asset: fonts/TrajanPro_Bold.ttf
69 | # weight: 700
70 | #
71 | # For details regarding fonts from package dependencies,
72 | # see https://flutter.dev/custom-fonts/#from-packages
73 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # Visual Studio Code related
19 | .vscode/
20 |
21 | # Flutter/Dart/Pub related
22 | **/doc/api/
23 | .dart_tool/
24 | .flutter-plugins
25 | .packages
26 | .pub-cache/
27 | .pub/
28 | /build/
29 |
30 | # Android related
31 | **/android/**/gradle-wrapper.jar
32 | **/android/.gradle
33 | **/android/captures/
34 | **/android/gradlew
35 | **/android/gradlew.bat
36 | **/android/local.properties
37 | **/android/**/GeneratedPluginRegistrant.java
38 |
39 | # iOS/XCode related
40 | **/ios/**/*.mode1v3
41 | **/ios/**/*.mode2v3
42 | **/ios/**/*.moved-aside
43 | **/ios/**/*.pbxuser
44 | **/ios/**/*.perspectivev3
45 | **/ios/**/*sync/
46 | **/ios/**/.sconsign.dblite
47 | **/ios/**/.tags*
48 | **/ios/**/.vagrant/
49 | **/ios/**/DerivedData/
50 | **/ios/**/Icon?
51 | **/ios/**/Pods/
52 | **/ios/**/.symlinks/
53 | **/ios/**/profile
54 | **/ios/**/xcuserdata
55 | **/ios/.generated/
56 | **/ios/Flutter/App.framework
57 | **/ios/Flutter/Flutter.framework
58 | **/ios/Flutter/Generated.xcconfig
59 | **/ios/Flutter/app.flx
60 | **/ios/Flutter/app.zip
61 | **/ios/Flutter/flutter_assets/
62 | **/ios/ServiceDefinitions.json
63 | **/ios/Runner/GeneratedPluginRegistrant.*
64 |
65 | # Exceptions to above rules.
66 | !**/ios/**/default.mode1v3
67 | !**/ios/**/default.mode2v3
68 | !**/ios/**/default.pbxuser
69 | !**/ios/**/default.perspectivev3
70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
71 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/README.md:
--------------------------------------------------------------------------------
1 | # hello_modern_languages
2 |
3 | A new Flutter project.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13 |
14 | For help getting started with Flutter, view our
15 | [online documentation](https://flutter.dev/docs), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion 28
30 |
31 | sourceSets {
32 | main.java.srcDirs += 'src/main/kotlin'
33 | }
34 |
35 | lintOptions {
36 | disable 'InvalidPackage'
37 | }
38 |
39 | defaultConfig {
40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
41 | applicationId "com.example.hello_modern_languages"
42 | minSdkVersion 16
43 | targetSdkVersion 28
44 | versionCode flutterVersionCode.toInteger()
45 | versionName flutterVersionName
46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
47 | }
48 |
49 | buildTypes {
50 | release {
51 | // TODO: Add your own signing config for the release build.
52 | // Signing with the debug keys for now, so `flutter run --release` works.
53 | signingConfig signingConfigs.debug
54 | }
55 | }
56 | }
57 |
58 | flutter {
59 | source '../..'
60 | }
61 |
62 | dependencies {
63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
64 | testImplementation 'junit:junit:4.12'
65 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
66 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
67 | }
68 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
9 |
13 |
20 |
24 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/app/src/main/kotlin/com/example/hello_modern_languages/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.hello_modern_languages
2 |
3 | import android.os.Bundle
4 |
5 | import io.flutter.app.FlutterActivity
6 | import io.flutter.plugins.GeneratedPluginRegistrant
7 |
8 | class MainActivity: FlutterActivity() {
9 | override fun onCreate(savedInstanceState: Bundle?) {
10 | super.onCreate(savedInstanceState)
11 | GeneratedPluginRegistrant.registerWith(this)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.2.71'
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.2.1'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | jcenter()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
7 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/Flutter-Cookbook/4c12a740f0103bd6ba68ed28f3ca36fd59d7ccd3/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | hello_modern_languages
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: hello_modern_languages
2 | description: A new Flutter project.
3 |
4 | # The following defines the version and build number for your application.
5 | # A version number is three numbers separated by dots, like 1.2.43
6 | # followed by an optional build number separated by a +.
7 | # Both the version and the builder number may be overridden in flutter
8 | # build by specifying --build-name and --build-number, respectively.
9 | # In Android, build-name is used as versionName while build-number used as versionCode.
10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
12 | # Read more about iOS versioning at
13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
14 | version: 1.0.0+1
15 |
16 | environment:
17 | sdk: ">=2.1.0 <3.0.0"
18 |
19 | dependencies:
20 | flutter:
21 | sdk: flutter
22 |
23 | # The following adds the Cupertino Icons font to your application.
24 | # Use with the CupertinoIcons class for iOS style icons.
25 | cupertino_icons: ^0.1.2
26 |
27 | dev_dependencies:
28 | flutter_test:
29 | sdk: flutter
30 |
31 |
32 | # For information on the generic Dart part of this file, see the
33 | # following page: https://www.dartlang.org/tools/pub/pubspec
34 |
35 | # The following section is specific to Flutter.
36 | flutter:
37 |
38 | # The following line ensures that the Material Icons font is
39 | # included with your application, so that you can use the icons in
40 | # the material Icons class.
41 | uses-material-design: true
42 |
43 | # To add assets to your application, add an assets section, like this:
44 | # assets:
45 | # - images/a_dot_burr.jpeg
46 | # - images/a_dot_ham.jpeg
47 |
48 | # An image asset can refer to one or more resolution-specific "variants", see
49 | # https://flutter.dev/assets-and-images/#resolution-aware.
50 |
51 | # For details regarding adding assets from package dependencies, see
52 | # https://flutter.dev/assets-and-images/#from-packages
53 |
54 | # To add custom fonts to your application, add a fonts section here,
55 | # in this "flutter" section. Each entry in this list should have a
56 | # "family" key with the font family name, and a "fonts" key with a
57 | # list giving the asset and other descriptors for the font. For
58 | # example:
59 | # fonts:
60 | # - family: Schyler
61 | # fonts:
62 | # - asset: fonts/Schyler-Regular.ttf
63 | # - asset: fonts/Schyler-Italic.ttf
64 | # style: italic
65 | # - family: Trajan Pro
66 | # fonts:
67 | # - asset: fonts/TrajanPro.ttf
68 | # - asset: fonts/TrajanPro_Bold.ttf
69 | # weight: 700
70 | #
71 | # For details regarding fonts from package dependencies,
72 | # see https://flutter.dev/custom-fonts/#from-packages
73 |
--------------------------------------------------------------------------------
/chapter_01/hello_modern_languages/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility that Flutter provides. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:hello_modern_languages/main.dart';
12 |
13 | void main() {
14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(MyApp());
17 |
18 | // Verify that our counter starts at 0.
19 | expect(find.text('0'), findsOneWidget);
20 | expect(find.text('1'), findsNothing);
21 |
22 | // Tap the '+' icon and trigger a frame.
23 | await tester.tap(find.byIcon(Icons.add));
24 | await tester.pump();
25 |
26 | // Verify that our counter has incremented.
27 | expect(find.text('0'), findsNothing);
28 | expect(find.text('1'), findsOneWidget);
29 | });
30 | }
31 |
--------------------------------------------------------------------------------
/chapter_02/.gitignore:
--------------------------------------------------------------------------------
1 | # Files and directories created by pub
2 | .dart_tool/
3 | .packages
4 | # Remove the following pattern if you wish to check in your lock file
5 | pubspec.lock
6 |
7 | # Conventional directory for build outputs
8 | build/
9 |
10 | # Directory created by dartdoc
11 | doc/api/
12 |
--------------------------------------------------------------------------------
/chapter_02/02_introduction_to_dart.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/chapter_02/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 1.0.0
2 |
3 | - Initial version, created by Stagehand
4 |
--------------------------------------------------------------------------------
/chapter_02/README.md:
--------------------------------------------------------------------------------
1 | A sample command-line application.
2 |
3 | Created from templates made available by Stagehand under a BSD-style
4 | [license](https://github.com/dart-lang/stagehand/blob/master/LICENSE).
5 |
--------------------------------------------------------------------------------
/chapter_02/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # Defines a default set of lint rules enforced for
2 | # projects at Google. For details and rationale,
3 | # see https://github.com/dart-lang/pedantic#enabled-lints.
4 | include: package:pedantic/analysis_options.yaml
5 |
6 | # For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
7 | # Uncomment to specify additional rules.
8 | # linter:
9 | # rules:
10 | # - camel_case_types
11 |
12 | analyzer:
13 | # exclude:
14 | # - path/to/excluded/files/**
15 |
--------------------------------------------------------------------------------
/chapter_02/bin/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:introduction_to_dart/01-declaring_variables.dart';
2 | import 'package:introduction_to_dart/02-strings.dart';
3 | import 'package:introduction_to_dart/03-functions.dart';
4 | import 'package:introduction_to_dart/04-classes.dart';
5 | import 'package:introduction_to_dart/05-generics.dart';
6 | import 'package:introduction_to_dart/06-collections.dart';
7 | import 'package:introduction_to_dart/07-higher-order-functions.dart';
8 | import 'package:introduction_to_dart/08-cascade.dart';
9 |
10 | // Every Dart program starts
11 | // from this function
12 | main() {
13 | variablePlayground();
14 | stringPlayground();
15 | functionPlayground();
16 | classPlayground();
17 | genericsPlayground();
18 | collectionPlayground();
19 | higherOrderFunctions();
20 | cascadePlayground();
21 | }
22 |
--------------------------------------------------------------------------------
/chapter_02/lib/01-declaring_variables.dart:
--------------------------------------------------------------------------------
1 | // This a basic function called variablePlayground
2 | // that returns a void, aka - nothing
3 | void variablePlayground() {
4 | basicTypes();
5 | untypedVariables();
6 | typeInterpolation();
7 | immutableVariables();
8 | }
9 |
10 | // This should look familiar
11 | // to Java developers
12 | void basicTypes() {
13 | int four = 4;
14 | double pi = 3.14;
15 | num someNumber = 24601;
16 | bool yes = true;
17 | bool no = false;
18 |
19 | print(four);
20 | print(pi);
21 | print(someNumber);
22 | print(yes);
23 | print(no);
24 | }
25 |
26 | // This is a get out of jail free card
27 | // from the Dart type systems
28 | // It has its uses, but in most cases,
29 | // it should be avoided
30 | void untypedVariables() {
31 | dynamic something = 14.2;
32 | print(something.runtimeType);
33 | }
34 |
35 | // JavaScript developers should
36 | // recognize this syntax
37 | // Though unlike JavaScript, Dart will
38 | // remember the type that is being assigned to
39 | // these variables
40 | void typeInterpolation() {
41 | var anInteger = 15;
42 | var aDouble = 27.6;
43 | var aBoolean = false;
44 |
45 | print(anInteger.runtimeType);
46 | print(anInteger);
47 |
48 | print(aDouble.runtimeType);
49 | print(aDouble);
50 |
51 | print(aBoolean.runtimeType);
52 | print(aBoolean);
53 | }
54 |
55 | // This is the preferred way to declare variables
56 | // The `final` keyword will only allow you assign
57 | // a variable once.
58 | void immutableVariables() {
59 | final int immutableInteger = 5;
60 | final double immutableDouble = 0.015;
61 |
62 | // Type annotation is optional
63 | final interpolatedInteger = 10;
64 | final interpolatedDouble = 72.8;
65 |
66 | print(interpolatedInteger);
67 | print(interpolatedDouble);
68 |
69 | const aFullySealedVariable = true;
70 | print(aFullySealedVariable);
71 | }
72 |
--------------------------------------------------------------------------------
/chapter_02/lib/02-strings.dart:
--------------------------------------------------------------------------------
1 | void stringPlayground() {
2 | basicStringDeclaration();
3 | multiLineStrings();
4 | combiningStrings();
5 | }
6 |
7 | void basicStringDeclaration() {
8 | // With Single Quotes
9 | print('Single quotes');
10 | final aBoldStatement = 'Dart isn\'t loosely typed.';
11 | print(aBoldStatement);
12 |
13 | // With Double Quotes
14 | print("Hello, World");
15 | final aMoreMildOpinion = "Dart's popularity has skyrocketed with Flutter!";
16 | print(aMoreMildOpinion);
17 |
18 | // Combining single and double quotes
19 | final mixAndMatch =
20 | 'Every programmer should write "Hello, World" when learning a new language.';
21 | print(mixAndMatch);
22 | }
23 |
24 | void multiLineStrings() {
25 | final withEscaping = 'One Fish\nTwo Fish\nRed Fish\nBlue Fish';
26 | print(withEscaping);
27 |
28 | final hamlet = '''
29 | To be, or not to be, that is the question:
30 | Whether 'tis nobler in the mind to suffer
31 | The slings and arrows of outrageous fortune,
32 | Or to take arms against a sea of troubles
33 | And by opposing end them.
34 | ''';
35 |
36 | print(hamlet);
37 | }
38 |
39 | void combiningStrings() {
40 | traditionalConcatenation();
41 | modernInterpolation();
42 | }
43 |
44 | void traditionalConcatenation() {
45 | final hello = 'Hello';
46 | final world = "world";
47 |
48 | final combined = hello + ' ' + world;
49 |
50 | print(combined);
51 | }
52 |
53 | void modernInterpolation() {
54 | final year = 2011;
55 | final interpolated = 'Dart was announced in $year.';
56 | print(interpolated);
57 |
58 | final age = 35;
59 | final howOld = 'I am $age ${age == 1 ? 'year' : 'years'} old.';
60 | print(howOld);
61 | }
62 |
--------------------------------------------------------------------------------
/chapter_02/lib/03-functions.dart:
--------------------------------------------------------------------------------
1 | void functionPlayground() {
2 | classicalFunctions();
3 | optionalParameters();
4 | consumeClosure();
5 | }
6 |
7 | ///////////////////////////////
8 | // This should look familiar //
9 | ///////////////////////////////
10 |
11 | void printMyName(String name) {
12 | print('Hello $name');
13 | }
14 |
15 | int add(int a, int b) {
16 | return a + b;
17 | }
18 |
19 | int factorial(int number) {
20 | if (number <= 0) {
21 | return 1;
22 | }
23 |
24 | return number * factorial(number - 1);
25 | }
26 |
27 | void classicalFunctions() {
28 | printMyName('Anna');
29 | printMyName('Irina');
30 |
31 | final sum = add(5, 3);
32 | print(sum);
33 |
34 | print('10 Factorial is ${factorial(10)}');
35 | }
36 |
37 | ///////////////////////////
38 | // Now for the new stuff //
39 | ///////////////////////////
40 |
41 | // Wrap optional parameters in square brackets
42 | void unnamed([String name, int age]) {
43 | final actualName = name ?? 'Unknown';
44 | final actualAge = age ?? 0;
45 | print('$actualName is $actualAge years old.');
46 | }
47 |
48 | // Wrap named optional parameters in curly brackets
49 | void named({String greeting, String name}) {
50 | final actualGreeting = greeting ?? 'Hello';
51 | final actualName = name ?? 'Mystery Person';
52 | print('$actualGreeting, $actualName!');
53 | }
54 |
55 | // You can mix required parameters with optional
56 | // Optional parameters can also have default values
57 | String duplicate(String name, {int times = 1}) {
58 | String merged = '';
59 | for (int i = 0; i < times; i++) {
60 | merged += name;
61 | if (i != times - 1) {
62 | merged += ' ';
63 | }
64 | }
65 |
66 | return merged;
67 | }
68 |
69 | void optionalParameters() {
70 | unnamed('Huxley', 3);
71 | unnamed();
72 |
73 | // Notice how parameters can be in any order
74 | // Flutter uses this a lot. You should too.
75 | named(greeting: 'Greetings and Salutations');
76 | named(name: 'Sonia');
77 | named(name: 'Alex', greeting: 'Bonjour');
78 |
79 | final multiply = duplicate('Mikey', times: 3);
80 | print(multiply);
81 | }
82 |
83 | ///////////////////
84 | // Closure Time! //
85 | ///////////////////
86 |
87 | // Define closure types for easy use
88 | typedef int numberGetter();
89 |
90 | int powerOfTwo({numberGetter getter}) {
91 | return getter() * getter();
92 | }
93 |
94 | // Or don't define the closure ahead of time
95 | // and just describe it in the function signature
96 | void callbackExample(void callback(String value)) {
97 | callback('Hello Callback');
98 | }
99 |
100 | void closureInvoker(void Function() aClosure) {
101 | aClosure();
102 | }
103 |
104 | void consumeClosure() {
105 | final firstClassFunction = () {
106 | print('I am a closure!');
107 | };
108 |
109 | closureInvoker(firstClassFunction);
110 | closureInvoker(() {
111 | print('I am written inline');
112 | });
113 |
114 | final getFour = () => 4;
115 | final squared = powerOfTwo(getter: getFour);
116 | print(squared);
117 |
118 | callbackExample((result) {
119 | print(result);
120 | });
121 | }
122 |
--------------------------------------------------------------------------------
/chapter_02/lib/04-classes.dart:
--------------------------------------------------------------------------------
1 | import 'package:meta/meta.dart';
2 |
3 | // An immutable object
4 | class Name {
5 | final String first;
6 | final String last;
7 |
8 | const Name(this.first, this.last);
9 |
10 | @override
11 | bool operator ==(Object other) =>
12 | identical(this, other) ||
13 | other is Name &&
14 | runtimeType == other.runtimeType &&
15 | first == other.first &&
16 | last == other.last;
17 |
18 | @override
19 | int get hashCode => first.hashCode ^ last.hashCode;
20 |
21 | @override
22 | String toString() {
23 | return '$first $last';
24 | }
25 |
26 | // Dart has the factory pattern baked into the language
27 | factory Name.fromValues({
28 | String title,
29 | @required String first,
30 | @required String last,
31 | }) {
32 | // optional properties can be annotated @required,
33 | // but this is just for the IDE, not the language.
34 | // This can enforced with assert statements
35 | assert(first != null);
36 | assert(last != null);
37 |
38 | if (title != null) {
39 | return OfficialName(title, first, last);
40 | }
41 |
42 | return Name(first, last);
43 | }
44 | }
45 |
46 | // A subclass; also immutable
47 | class OfficialName extends Name {
48 | // Private properties begin with an underscore
49 | final String _title;
50 |
51 | // You can add colons after constructor
52 | // to parse data or delegate to super
53 | const OfficialName(this._title, String first, String last)
54 | : super(first, last);
55 |
56 | @override
57 | String toString() {
58 | return '$_title. ${super.toString()}';
59 | }
60 | }
61 |
62 | // Abstract class in Dart can function the same as Interfaces/Protocols
63 | abstract class Greeter {
64 | String sayHello();
65 | }
66 |
67 | // Mixins are like Protocol Extensions.
68 | // Here you can define default behaviour
69 | // The only difference if you do not have to define
70 | // an interface beforehand
71 | mixin DefaultedGreeter implements Greeter {
72 | String get name;
73 |
74 | @override
75 | String sayHello() {
76 | return 'Hello $name';
77 | }
78 | }
79 |
80 | // The 'with' keyword is how you conform to a mixin
81 | class ConcreteGreeter with DefaultedGreeter {
82 | // Putting an underscore before a property
83 | // makes it private
84 | final Name _name;
85 |
86 | ConcreteGreeter(this._name);
87 |
88 | @override
89 | String get name => _name.toString();
90 | }
91 |
92 | void classPlayground() {
93 | final name = OfficialName('Mr', 'Francois', 'Rabelais');
94 | final greeter = ConcreteGreeter(name);
95 | final message = greeter.sayHello();
96 | print(message);
97 | }
98 |
--------------------------------------------------------------------------------
/chapter_02/lib/05-generics.dart:
--------------------------------------------------------------------------------
1 | // A basic generic class
2 | // This type can hold anything
3 | class Optional {
4 | final T _value;
5 | T get value => _value;
6 |
7 | const Optional(this._value);
8 |
9 | bool exists() => _value != null;
10 | }
11 |
12 | // A constrained generic class
13 | // Only type that implement the printable interface
14 | // can be used for this class
15 | abstract class Loggable {
16 | void log();
17 | }
18 |
19 | class LoggableList {
20 | final List loggables;
21 |
22 | LoggableList(this.loggables);
23 | void printAll() {
24 | final Iterable it = [1, 2, 3].where((_) => true);
25 |
26 | for (Loggable logable in loggables) {
27 | logable.log();
28 | }
29 | }
30 | }
31 |
32 | class LoggableString implements Loggable {
33 | final String text;
34 |
35 | const LoggableString(this.text);
36 |
37 | @override
38 | void log() {
39 | print(text);
40 | }
41 | }
42 |
43 | // A generic function.
44 | // The type is defined between the name of the function
45 | // and the parameter list
46 | T adder(T a, T b) {
47 | return a + b;
48 | }
49 |
50 | void genericsPlayground() {
51 | final a = Optional(10);
52 | final b = Optional(100);
53 | final nothing = Optional(null);
54 | print(a.value);
55 | print(b.value);
56 | print(nothing.exists());
57 |
58 | // Notice how dart is able to infer the generic type
59 | // You don't always have to be explicit
60 | final strings = List.generate(
61 | 20,
62 | (i) => LoggableString(i.toRadixString(2)),
63 | );
64 | final list = LoggableList(strings);
65 | list.printAll();
66 |
67 | final sum = adder(a.value, b.value);
68 | print('Sum is a ${sum.runtimeType} and its value is $sum');
69 | }
70 |
--------------------------------------------------------------------------------
/chapter_02/lib/06-collections.dart:
--------------------------------------------------------------------------------
1 | import 'package:introduction_to_dart/04-classes.dart';
2 |
3 | void collectionPlayground() {
4 | listPlayground();
5 | mapPlayground();
6 | setPlayground();
7 | collectionControlFlow();
8 | }
9 |
10 | void listPlayground() {
11 | // Creating with list literal syntax
12 | final numbers = [1, 2, 3, 5, 7];
13 |
14 | numbers.add(10);
15 | numbers.addAll([4, 1, 35]);
16 |
17 | // Assigning via subscript
18 | numbers[1] = 15;
19 |
20 | print('The second nunber is ${numbers[1]}');
21 |
22 | // enumerating a list
23 | for (int number in numbers) {
24 | print(number);
25 | }
26 | }
27 |
28 | void mapPlayground() {
29 | // Map Literal syntax
30 | final Map ages = {
31 | 'Mike': 18,
32 | 'Peter': 35,
33 | 'Jennifer': 26,
34 | };
35 |
36 | // Subscript syntax uses the key type.
37 | // A String in this case
38 | ages['Tom'] = 48;
39 |
40 | final ageOfPeter = ages['Peter'];
41 | print('Peter is $ageOfPeter years old.');
42 |
43 | ages.remove('Peter');
44 |
45 | ages.forEach((String name, int age) {
46 | print('$name is $age years old');
47 | });
48 |
49 | final james = Name('James', 'Buchanan');
50 | final brenda = Name('Brenda', 'Fitzpatrick');
51 |
52 | final namesAndAges = {
53 | james: 83,
54 | brenda: 53,
55 | };
56 | }
57 |
58 | void setPlayground() {
59 | // Set literal, similar to Map, but no keys
60 | final ministers = {'Justin', 'Stephen', 'Paul', 'Jean', 'Kim', 'Brian'};
61 | ministers.addAll({'John', 'Pierre', 'Joe', 'Pierre'});
62 |
63 | // These sort of queries are much faster than Lists
64 | final isJustinAMinister = ministers.contains('Justin');
65 | print(isJustinAMinister);
66 |
67 | // Notice how 'Pierre' will only be printed once
68 | // In sets, duplicates are automatically rejected
69 | for (String primeMinister in ministers) {
70 | print('$primeMinister is a Prime Minister.');
71 | }
72 | }
73 |
74 | void collectionControlFlow() {
75 | // Dart now allows you to add control flow inside array declarations
76 | // These language features were developed specifically for Flutter
77 |
78 | // You can now include if states, for loops
79 | // and spread operators inside collections
80 | final addMore = true;
81 | final randomNumbers = [
82 | 34,
83 | 232,
84 | 54,
85 | 32,
86 | if (addMore) ...[
87 | 534343,
88 | 4423,
89 | 3432432,
90 | ],
91 | ];
92 |
93 | final duplicated = [
94 | for (int number in randomNumbers) number * 2,
95 | for (int i = 0; i < 100; i++) i,
96 | ];
97 |
98 | print(duplicated);
99 | }
100 |
--------------------------------------------------------------------------------
/chapter_02/lib/07-higher-order-functions.dart:
--------------------------------------------------------------------------------
1 | import 'package:introduction_to_dart/04-classes.dart';
2 |
3 | void higherOrderFunctions() {
4 | final names = mapping();
5 | names.forEach(print);
6 |
7 | sorting();
8 | filtering();
9 | reducing();
10 | flattening();
11 | }
12 |
13 | List