Adding JSON example. (#1)

pull/2/head
Andrew Brogdon 6 years ago committed by GitHub
parent 05319d3e8c
commit f0fe2289e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,9 @@
.DS_Store
.dart_tool/
.packages
.pub/
.idea
.atom
.flutter-plugins
build/
*.iml

@ -0,0 +1,8 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: 44b7e7d3f42f050a79712daab253af06e9daf530
channel: beta

@ -0,0 +1,44 @@
# jsonexample
A Flutter sample app that deserializes a set of JSON strings using three
different libraries: `dart:convert`, `json_serializable`, and
`built_value`.
## Goals for this sample
* Help you decide which of the three most common libraries for
deserializing JSON is right for your project.
* Provide you with example code for deserializing:
* Simple and nested objects
* Lists of primitive values
* Maps containing primitive values
## The important bits
### `json_strings.dart`
The actual JSON to be deserialized.
### `dart_convert`/`json_serializable`/`dart_convert`
These folders contain code used to deserialize the simple and complex
object models using one of the three libraries. They do the work of
instantiating models and populating their fields.
### `tab_pages.dart`
Each tab page in the app deserializes one type of data with one library.
These Widgets show what app code using the above libraries might look like.
## Questions/issues
If you have a general question about JSON serialization in Flutter, the
best places to go are:
* [The FlutterDev Google Group](https://groups.google.com/forum/#!forum/flutter-dev)
* [The Flutter Gitter channel](https://gitter.im/flutter/flutter)
* [StackOverflow](https://stackoverflow.com/questions/tagged/flutter)
If you run into an issue with the sample itself, please file an issue
in the [main Flutter repo](https://github.com/flutter/flutter/issues).

@ -0,0 +1,10 @@
*.iml
*.class
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
GeneratedPluginRegistrant.java

@ -0,0 +1,51 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 27
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.google.example.jsonexample"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

@ -0,0 +1,39 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.example.jsonexample">
<!-- The INTERNET permission is required for development. Specifically,
flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="jsonexample"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>

@ -0,0 +1,14 @@
package com.google.example.jsonexample;
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
}
}

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
</resources>

@ -0,0 +1,29 @@
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}

@ -0,0 +1 @@
org.gradle.jvmargs=-Xmx1536M

@ -0,0 +1,6 @@
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

@ -0,0 +1,15 @@
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}
plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}

@ -0,0 +1,26 @@
targets:
$default:
builders:
built_value_generator|built_value:
generate_for:
- lib/built_value/*.dart
options:
header: |
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// GENERATED CODE - DO NOT MODIFY BY HAND
json_serializable|json_serializable:
generate_for:
- lib/json_serializable/*.dart
options:
header: |
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// GENERATED CODE - DO NOT MODIFY BY HAND

@ -0,0 +1,44 @@
.idea/
.vagrant/
.sconsign.dblite
.svn/
.DS_Store
*.swp
profile
DerivedData/
build/
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m
.generated/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
xcuserdata
*.moved-aside
*.pyc
*sync/
Icon?
.tags*
/Flutter/app.flx
/Flutter/app.zip
/Flutter/flutter_assets/
/Flutter/App.framework
/Flutter/Flutter.framework
/Flutter/Generated.xcconfig
/ServiceDefinitions.json
Pods/

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>MinimumOSVersion</key>
<string>8.0</string>
</dict>
</plist>

@ -0,0 +1 @@
#include "Generated.xcconfig"

@ -0,0 +1 @@
#include "Generated.xcconfig"

@ -0,0 +1,440 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
3B80C3931E831B6300D905FE /* App.framework */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEBA1CF902C7004384FC /* Flutter.framework */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
);
name = Flutter;
sourceTree = "<group>";
};
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
);
sourceTree = "<group>";
};
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
);
name = Products;
sourceTree = "<group>";
};
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
97C146F11CF9000F007C117D /* Supporting Files */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
);
path = Runner;
sourceTree = "<group>";
};
97C146F11CF9000F007C117D /* Supporting Files */ = {
isa = PBXGroup;
children = (
97C146F21CF9000F007C117D /* main.m */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
);
buildRules = (
);
dependencies = (
);
name = Runner;
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0910;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
};
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
97C146EC1CF9000F007C117D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
97C146F31CF9000F007C117D /* main.m in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C146FB1CF9000F007C117D /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
97C147061CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ARCHS = arm64;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.google.example.jsonexample;
PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
};
97C147071CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ARCHS = arm64;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 1;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.google.example.jsonexample;
PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147031CF9000F007C117D /* Debug */,
97C147041CF9000F007C117D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147061CF9000F007C117D /* Debug */,
97C147071CF9000F007C117D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>

@ -0,0 +1,6 @@
#import <UIKit/UIKit.h>
#import <Flutter/Flutter.h>
@interface AppDelegate : FlutterAppDelegate
@end

@ -0,0 +1,12 @@
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch.
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end

@ -0,0 +1,122 @@
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

@ -0,0 +1,5 @@
# Launch Screen Assets
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
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.

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
</resources>
</document>

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>jsonexample</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>

@ -0,0 +1,9 @@
#import <UIKit/UIKit.h>
#import <Flutter/Flutter.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

@ -0,0 +1,40 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:built_collection/built_collection.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
import 'package:jsonexample/built_value/built_simple_object.dart';
part 'built_complex_object.g.dart';
abstract class BuiltComplexObject
implements Built<BuiltComplexObject, BuiltComplexObjectBuilder> {
static Serializer<BuiltComplexObject> get serializer =>
_$builtComplexObjectSerializer;
@nullable
String get aString;
@nullable
int get anInt;
@nullable
double get aDouble;
BuiltSimpleObject get anObject;
BuiltList<String> get aListOfStrings;
BuiltList<int> get aListOfInts;
BuiltList<double> get aListOfDoubles;
BuiltList<BuiltSimpleObject> get aListOfObjects;
BuiltComplexObject._();
factory BuiltComplexObject([updates(BuiltComplexObjectBuilder b)]) =
_$BuiltComplexObject;
}

@ -0,0 +1,345 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'built_complex_object.dart';
// **************************************************************************
// Generator: BuiltValueGenerator
// **************************************************************************
// ignore_for_file: always_put_control_body_on_new_line
// ignore_for_file: annotate_overrides
// ignore_for_file: avoid_annotating_with_dynamic
// ignore_for_file: avoid_returning_this
// ignore_for_file: omit_local_variable_types
// ignore_for_file: prefer_expression_function_bodies
// ignore_for_file: sort_constructors_first
Serializer<BuiltComplexObject> _$builtComplexObjectSerializer =
new _$BuiltComplexObjectSerializer();
class _$BuiltComplexObjectSerializer
implements StructuredSerializer<BuiltComplexObject> {
@override
final Iterable<Type> types = const [BuiltComplexObject, _$BuiltComplexObject];
@override
final String wireName = 'BuiltComplexObject';
@override
Iterable serialize(Serializers serializers, BuiltComplexObject object,
{FullType specifiedType: FullType.unspecified}) {
final result = <Object>[
'anObject',
serializers.serialize(object.anObject,
specifiedType: const FullType(BuiltSimpleObject)),
'aListOfStrings',
serializers.serialize(object.aListOfStrings,
specifiedType:
const FullType(BuiltList, const [const FullType(String)])),
'aListOfInts',
serializers.serialize(object.aListOfInts,
specifiedType:
const FullType(BuiltList, const [const FullType(int)])),
'aListOfDoubles',
serializers.serialize(object.aListOfDoubles,
specifiedType:
const FullType(BuiltList, const [const FullType(double)])),
'aListOfObjects',
serializers.serialize(object.aListOfObjects,
specifiedType: const FullType(
BuiltList, const [const FullType(BuiltSimpleObject)])),
];
if (object.aString != null) {
result
..add('aString')
..add(serializers.serialize(object.aString,
specifiedType: const FullType(String)));
}
if (object.anInt != null) {
result
..add('anInt')
..add(serializers.serialize(object.anInt,
specifiedType: const FullType(int)));
}
if (object.aDouble != null) {
result
..add('aDouble')
..add(serializers.serialize(object.aDouble,
specifiedType: const FullType(double)));
}
return result;
}
@override
BuiltComplexObject deserialize(Serializers serializers, Iterable serialized,
{FullType specifiedType: FullType.unspecified}) {
final result = new BuiltComplexObjectBuilder();
final iterator = serialized.iterator;
while (iterator.moveNext()) {
final key = iterator.current as String;
iterator.moveNext();
final dynamic value = iterator.current;
switch (key) {
case 'aString':
result.aString = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'anInt':
result.anInt = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
case 'aDouble':
result.aDouble = serializers.deserialize(value,
specifiedType: const FullType(double)) as double;
break;
case 'anObject':
result.anObject.replace(serializers.deserialize(value,
specifiedType: const FullType(BuiltSimpleObject))
as BuiltSimpleObject);
break;
case 'aListOfStrings':
result.aListOfStrings.replace(serializers.deserialize(value,
specifiedType:
const FullType(BuiltList, const [const FullType(String)]))
as BuiltList);
break;
case 'aListOfInts':
result.aListOfInts.replace(serializers.deserialize(value,
specifiedType:
const FullType(BuiltList, const [const FullType(int)]))
as BuiltList);
break;
case 'aListOfDoubles':
result.aListOfDoubles.replace(serializers.deserialize(value,
specifiedType:
const FullType(BuiltList, const [const FullType(double)]))
as BuiltList);
break;
case 'aListOfObjects':
result.aListOfObjects.replace(serializers.deserialize(value,
specifiedType: const FullType(
BuiltList, const [const FullType(BuiltSimpleObject)]))
as BuiltList);
break;
}
}
return result.build();
}
}
class _$BuiltComplexObject extends BuiltComplexObject {
@override
final String aString;
@override
final int anInt;
@override
final double aDouble;
@override
final BuiltSimpleObject anObject;
@override
final BuiltList<String> aListOfStrings;
@override
final BuiltList<int> aListOfInts;
@override
final BuiltList<double> aListOfDoubles;
@override
final BuiltList<BuiltSimpleObject> aListOfObjects;
factory _$BuiltComplexObject([void updates(BuiltComplexObjectBuilder b)]) =>
(new BuiltComplexObjectBuilder()..update(updates)).build();
_$BuiltComplexObject._(
{this.aString,
this.anInt,
this.aDouble,
this.anObject,
this.aListOfStrings,
this.aListOfInts,
this.aListOfDoubles,
this.aListOfObjects})
: super._() {
if (anObject == null)
throw new BuiltValueNullFieldError('BuiltComplexObject', 'anObject');
if (aListOfStrings == null)
throw new BuiltValueNullFieldError(
'BuiltComplexObject', 'aListOfStrings');
if (aListOfInts == null)
throw new BuiltValueNullFieldError('BuiltComplexObject', 'aListOfInts');
if (aListOfDoubles == null)
throw new BuiltValueNullFieldError(
'BuiltComplexObject', 'aListOfDoubles');
if (aListOfObjects == null)
throw new BuiltValueNullFieldError(
'BuiltComplexObject', 'aListOfObjects');
}
@override
BuiltComplexObject rebuild(void updates(BuiltComplexObjectBuilder b)) =>
(toBuilder()..update(updates)).build();
@override
BuiltComplexObjectBuilder toBuilder() =>
new BuiltComplexObjectBuilder()..replace(this);
@override
bool operator ==(dynamic other) {
if (identical(other, this)) return true;
if (other is! BuiltComplexObject) return false;
return aString == other.aString &&
anInt == other.anInt &&
aDouble == other.aDouble &&
anObject == other.anObject &&
aListOfStrings == other.aListOfStrings &&
aListOfInts == other.aListOfInts &&
aListOfDoubles == other.aListOfDoubles &&
aListOfObjects == other.aListOfObjects;
}
@override
int get hashCode {
return $jf($jc(
$jc(
$jc(
$jc(
$jc(
$jc($jc($jc(0, aString.hashCode), anInt.hashCode),
aDouble.hashCode),
anObject.hashCode),
aListOfStrings.hashCode),
aListOfInts.hashCode),
aListOfDoubles.hashCode),
aListOfObjects.hashCode));
}
@override
String toString() {
return (newBuiltValueToStringHelper('BuiltComplexObject')
..add('aString', aString)
..add('anInt', anInt)
..add('aDouble', aDouble)
..add('anObject', anObject)
..add('aListOfStrings', aListOfStrings)
..add('aListOfInts', aListOfInts)
..add('aListOfDoubles', aListOfDoubles)
..add('aListOfObjects', aListOfObjects))
.toString();
}
}
class BuiltComplexObjectBuilder
implements Builder<BuiltComplexObject, BuiltComplexObjectBuilder> {
_$BuiltComplexObject _$v;
String _aString;
String get aString => _$this._aString;
set aString(String aString) => _$this._aString = aString;
int _anInt;
int get anInt => _$this._anInt;
set anInt(int anInt) => _$this._anInt = anInt;
double _aDouble;
double get aDouble => _$this._aDouble;
set aDouble(double aDouble) => _$this._aDouble = aDouble;
BuiltSimpleObjectBuilder _anObject;
BuiltSimpleObjectBuilder get anObject =>
_$this._anObject ??= new BuiltSimpleObjectBuilder();
set anObject(BuiltSimpleObjectBuilder anObject) =>
_$this._anObject = anObject;
ListBuilder<String> _aListOfStrings;
ListBuilder<String> get aListOfStrings =>
_$this._aListOfStrings ??= new ListBuilder<String>();
set aListOfStrings(ListBuilder<String> aListOfStrings) =>
_$this._aListOfStrings = aListOfStrings;
ListBuilder<int> _aListOfInts;
ListBuilder<int> get aListOfInts =>
_$this._aListOfInts ??= new ListBuilder<int>();
set aListOfInts(ListBuilder<int> aListOfInts) =>
_$this._aListOfInts = aListOfInts;
ListBuilder<double> _aListOfDoubles;
ListBuilder<double> get aListOfDoubles =>
_$this._aListOfDoubles ??= new ListBuilder<double>();
set aListOfDoubles(ListBuilder<double> aListOfDoubles) =>
_$this._aListOfDoubles = aListOfDoubles;
ListBuilder<BuiltSimpleObject> _aListOfObjects;
ListBuilder<BuiltSimpleObject> get aListOfObjects =>
_$this._aListOfObjects ??= new ListBuilder<BuiltSimpleObject>();
set aListOfObjects(ListBuilder<BuiltSimpleObject> aListOfObjects) =>
_$this._aListOfObjects = aListOfObjects;
BuiltComplexObjectBuilder();
BuiltComplexObjectBuilder get _$this {
if (_$v != null) {
_aString = _$v.aString;
_anInt = _$v.anInt;
_aDouble = _$v.aDouble;
_anObject = _$v.anObject?.toBuilder();
_aListOfStrings = _$v.aListOfStrings?.toBuilder();
_aListOfInts = _$v.aListOfInts?.toBuilder();
_aListOfDoubles = _$v.aListOfDoubles?.toBuilder();
_aListOfObjects = _$v.aListOfObjects?.toBuilder();
_$v = null;
}
return this;
}
@override
void replace(BuiltComplexObject other) {
if (other == null) throw new ArgumentError.notNull('other');
_$v = other as _$BuiltComplexObject;
}
@override
void update(void updates(BuiltComplexObjectBuilder b)) {
if (updates != null) updates(this);
}
@override
_$BuiltComplexObject build() {
_$BuiltComplexObject _$result;
try {
_$result = _$v ??
new _$BuiltComplexObject._(
aString: aString,
anInt: anInt,
aDouble: aDouble,
anObject: anObject.build(),
aListOfStrings: aListOfStrings.build(),
aListOfInts: aListOfInts.build(),
aListOfDoubles: aListOfDoubles.build(),
aListOfObjects: aListOfObjects.build());
} catch (_) {
String _$failedField;
try {
_$failedField = 'anObject';
anObject.build();
_$failedField = 'aListOfStrings';
aListOfStrings.build();
_$failedField = 'aListOfInts';
aListOfInts.build();
_$failedField = 'aListOfDoubles';
aListOfDoubles.build();
_$failedField = 'aListOfObjects';
aListOfObjects.build();
} catch (e) {
throw new BuiltValueNestedFieldError(
'BuiltComplexObject', _$failedField, e.toString());
}
rethrow;
}
replace(_$result);
return _$result;
}
}

@ -0,0 +1,35 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:built_collection/built_collection.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
part 'built_simple_object.g.dart';
abstract class BuiltSimpleObject
implements Built<BuiltSimpleObject, BuiltSimpleObjectBuilder> {
static Serializer<BuiltSimpleObject> get serializer =>
_$builtSimpleObjectSerializer;
@nullable
String get aString;
@nullable
int get anInt;
@nullable
double get aDouble;
BuiltList<String> get aListOfStrings;
BuiltList<int> get aListOfInts;
BuiltList<double> get aListOfDoubles;
BuiltSimpleObject._();
factory BuiltSimpleObject([updates(BuiltSimpleObjectBuilder b)]) =
_$BuiltSimpleObject;
}

@ -0,0 +1,286 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'built_simple_object.dart';
// **************************************************************************
// Generator: BuiltValueGenerator
// **************************************************************************
// ignore_for_file: always_put_control_body_on_new_line
// ignore_for_file: annotate_overrides
// ignore_for_file: avoid_annotating_with_dynamic
// ignore_for_file: avoid_returning_this
// ignore_for_file: omit_local_variable_types
// ignore_for_file: prefer_expression_function_bodies
// ignore_for_file: sort_constructors_first
Serializer<BuiltSimpleObject> _$builtSimpleObjectSerializer =
new _$BuiltSimpleObjectSerializer();
class _$BuiltSimpleObjectSerializer
implements StructuredSerializer<BuiltSimpleObject> {
@override
final Iterable<Type> types = const [BuiltSimpleObject, _$BuiltSimpleObject];
@override
final String wireName = 'BuiltSimpleObject';
@override
Iterable serialize(Serializers serializers, BuiltSimpleObject object,
{FullType specifiedType: FullType.unspecified}) {
final result = <Object>[
'aListOfStrings',
serializers.serialize(object.aListOfStrings,
specifiedType:
const FullType(BuiltList, const [const FullType(String)])),
'aListOfInts',
serializers.serialize(object.aListOfInts,
specifiedType:
const FullType(BuiltList, const [const FullType(int)])),
'aListOfDoubles',
serializers.serialize(object.aListOfDoubles,
specifiedType:
const FullType(BuiltList, const [const FullType(double)])),
];
if (object.aString != null) {
result
..add('aString')
..add(serializers.serialize(object.aString,
specifiedType: const FullType(String)));
}
if (object.anInt != null) {
result
..add('anInt')
..add(serializers.serialize(object.anInt,
specifiedType: const FullType(int)));
}
if (object.aDouble != null) {
result
..add('aDouble')
..add(serializers.serialize(object.aDouble,
specifiedType: const FullType(double)));
}
return result;
}
@override
BuiltSimpleObject deserialize(Serializers serializers, Iterable serialized,
{FullType specifiedType: FullType.unspecified}) {
final result = new BuiltSimpleObjectBuilder();
final iterator = serialized.iterator;
while (iterator.moveNext()) {
final key = iterator.current as String;
iterator.moveNext();
final dynamic value = iterator.current;
switch (key) {
case 'aString':
result.aString = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'anInt':
result.anInt = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
case 'aDouble':
result.aDouble = serializers.deserialize(value,
specifiedType: const FullType(double)) as double;
break;
case 'aListOfStrings':
result.aListOfStrings.replace(serializers.deserialize(value,
specifiedType:
const FullType(BuiltList, const [const FullType(String)]))
as BuiltList);
break;
case 'aListOfInts':
result.aListOfInts.replace(serializers.deserialize(value,
specifiedType:
const FullType(BuiltList, const [const FullType(int)]))
as BuiltList);
break;
case 'aListOfDoubles':
result.aListOfDoubles.replace(serializers.deserialize(value,
specifiedType:
const FullType(BuiltList, const [const FullType(double)]))
as BuiltList);
break;
}
}
return result.build();
}
}
class _$BuiltSimpleObject extends BuiltSimpleObject {
@override
final String aString;
@override
final int anInt;
@override
final double aDouble;
@override
final BuiltList<String> aListOfStrings;
@override
final BuiltList<int> aListOfInts;
@override
final BuiltList<double> aListOfDoubles;
factory _$BuiltSimpleObject([void updates(BuiltSimpleObjectBuilder b)]) =>
(new BuiltSimpleObjectBuilder()..update(updates)).build();
_$BuiltSimpleObject._(
{this.aString,
this.anInt,
this.aDouble,
this.aListOfStrings,
this.aListOfInts,
this.aListOfDoubles})
: super._() {
if (aListOfStrings == null)
throw new BuiltValueNullFieldError('BuiltSimpleObject', 'aListOfStrings');
if (aListOfInts == null)
throw new BuiltValueNullFieldError('BuiltSimpleObject', 'aListOfInts');
if (aListOfDoubles == null)
throw new BuiltValueNullFieldError('BuiltSimpleObject', 'aListOfDoubles');
}
@override
BuiltSimpleObject rebuild(void updates(BuiltSimpleObjectBuilder b)) =>
(toBuilder()..update(updates)).build();
@override
BuiltSimpleObjectBuilder toBuilder() =>
new BuiltSimpleObjectBuilder()..replace(this);
@override
bool operator ==(dynamic other) {
if (identical(other, this)) return true;
if (other is! BuiltSimpleObject) return false;
return aString == other.aString &&
anInt == other.anInt &&
aDouble == other.aDouble &&
aListOfStrings == other.aListOfStrings &&
aListOfInts == other.aListOfInts &&
aListOfDoubles == other.aListOfDoubles;
}
@override
int get hashCode {
return $jf($jc(
$jc(
$jc(
$jc($jc($jc(0, aString.hashCode), anInt.hashCode),
aDouble.hashCode),
aListOfStrings.hashCode),
aListOfInts.hashCode),
aListOfDoubles.hashCode));
}
@override
String toString() {
return (newBuiltValueToStringHelper('BuiltSimpleObject')
..add('aString', aString)
..add('anInt', anInt)
..add('aDouble', aDouble)
..add('aListOfStrings', aListOfStrings)
..add('aListOfInts', aListOfInts)
..add('aListOfDoubles', aListOfDoubles))
.toString();
}
}
class BuiltSimpleObjectBuilder
implements Builder<BuiltSimpleObject, BuiltSimpleObjectBuilder> {
_$BuiltSimpleObject _$v;
String _aString;
String get aString => _$this._aString;
set aString(String aString) => _$this._aString = aString;
int _anInt;
int get anInt => _$this._anInt;
set anInt(int anInt) => _$this._anInt = anInt;
double _aDouble;
double get aDouble => _$this._aDouble;
set aDouble(double aDouble) => _$this._aDouble = aDouble;
ListBuilder<String> _aListOfStrings;
ListBuilder<String> get aListOfStrings =>
_$this._aListOfStrings ??= new ListBuilder<String>();
set aListOfStrings(ListBuilder<String> aListOfStrings) =>
_$this._aListOfStrings = aListOfStrings;
ListBuilder<int> _aListOfInts;
ListBuilder<int> get aListOfInts =>
_$this._aListOfInts ??= new ListBuilder<int>();
set aListOfInts(ListBuilder<int> aListOfInts) =>
_$this._aListOfInts = aListOfInts;
ListBuilder<double> _aListOfDoubles;
ListBuilder<double> get aListOfDoubles =>
_$this._aListOfDoubles ??= new ListBuilder<double>();
set aListOfDoubles(ListBuilder<double> aListOfDoubles) =>
_$this._aListOfDoubles = aListOfDoubles;
BuiltSimpleObjectBuilder();
BuiltSimpleObjectBuilder get _$this {
if (_$v != null) {
_aString = _$v.aString;
_anInt = _$v.anInt;
_aDouble = _$v.aDouble;
_aListOfStrings = _$v.aListOfStrings?.toBuilder();
_aListOfInts = _$v.aListOfInts?.toBuilder();
_aListOfDoubles = _$v.aListOfDoubles?.toBuilder();
_$v = null;
}
return this;
}
@override
void replace(BuiltSimpleObject other) {
if (other == null) throw new ArgumentError.notNull('other');
_$v = other as _$BuiltSimpleObject;
}
@override
void update(void updates(BuiltSimpleObjectBuilder b)) {
if (updates != null) updates(this);
}
@override
_$BuiltSimpleObject build() {
_$BuiltSimpleObject _$result;
try {
_$result = _$v ??
new _$BuiltSimpleObject._(
aString: aString,
anInt: anInt,
aDouble: aDouble,
aListOfStrings: aListOfStrings.build(),
aListOfInts: aListOfInts.build(),
aListOfDoubles: aListOfDoubles.build());
} catch (_) {
String _$failedField;
try {
_$failedField = 'aListOfStrings';
aListOfStrings.build();
_$failedField = 'aListOfInts';
aListOfInts.build();
_$failedField = 'aListOfDoubles';
aListOfDoubles.build();
} catch (e) {
throw new BuiltValueNestedFieldError(
'BuiltSimpleObject', _$failedField, e.toString());
}
rethrow;
}
replace(_$result);
return _$result;
}
}

@ -0,0 +1,25 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library serializers;
import 'package:built_collection/built_collection.dart';
import 'package:built_value/serializer.dart';
import 'package:built_value/standard_json_plugin.dart';
import 'package:jsonexample/built_value/built_complex_object.dart';
import 'package:jsonexample/built_value/built_simple_object.dart';
part 'built_value_serializers.g.dart';
@SerializersFor(const [
BuiltSimpleObject,
BuiltComplexObject,
])
// By default, `built_value` serialization uses lists and is not compatible
// with other JSON formats. If you'd like to serialize data using a map-based
// JSON approach (which is what you'll find in the json_strings.dart file in
// this project), you can add the StandardJsonPlugin as you see here.
final Serializers serializers =
(_$serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build();

@ -0,0 +1,45 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// GENERATED CODE - DO NOT MODIFY BY HAND
part of serializers;
// **************************************************************************
// Generator: BuiltValueGenerator
// **************************************************************************
// ignore_for_file: always_put_control_body_on_new_line
// ignore_for_file: annotate_overrides
// ignore_for_file: avoid_annotating_with_dynamic
// ignore_for_file: avoid_returning_this
// ignore_for_file: omit_local_variable_types
// ignore_for_file: prefer_expression_function_bodies
// ignore_for_file: sort_constructors_first
Serializers _$serializers = (new Serializers().toBuilder()
..add(BuiltComplexObject.serializer)
..add(BuiltSimpleObject.serializer)
..addBuilderFactory(
const FullType(BuiltList, const [const FullType(String)]),
() => new ListBuilder<String>())
..addBuilderFactory(
const FullType(BuiltList, const [const FullType(int)]),
() => new ListBuilder<int>())
..addBuilderFactory(
const FullType(BuiltList, const [const FullType(double)]),
() => new ListBuilder<double>())
..addBuilderFactory(
const FullType(BuiltList, const [const FullType(String)]),
() => new ListBuilder<String>())
..addBuilderFactory(
const FullType(BuiltList, const [const FullType(int)]),
() => new ListBuilder<int>())
..addBuilderFactory(
const FullType(BuiltList, const [const FullType(double)]),
() => new ListBuilder<double>())
..addBuilderFactory(
const FullType(BuiltList, const [const FullType(BuiltSimpleObject)]),
() => new ListBuilder<BuiltSimpleObject>()))
.build();

@ -0,0 +1,52 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:jsonexample/dart_convert/converted_simple_object.dart';
class ConvertedComplexObject {
const ConvertedComplexObject({
this.aString,
this.anInt,
this.aDouble,
this.anObject,
this.aListOfStrings,
this.aListOfInts,
this.aListOfDoubles,
this.aListOfObjects,
});
final String aString;
final int anInt;
final double aDouble;
final ConvertedSimpleObject anObject;
final List<String> aListOfStrings;
final List<int> aListOfInts;
final List<double> aListOfDoubles;
final List<ConvertedSimpleObject> aListOfObjects;
factory ConvertedComplexObject.fromJson(Map<String, dynamic> json) {
if (json == null) return null;
return ConvertedComplexObject(
aString: json['aString'],
anInt: json['anInt'],
aDouble: json['aDouble'],
anObject: json['anObject'] != null
? ConvertedSimpleObject.fromJson(json['anObject'])
: null,
aListOfStrings: json['aListOfStrings'] != null
? List<String>.from(json['aListOfStrings'])
: null,
aListOfInts: json['aListOfInts'] != null
? List<int>.from(json['aListOfInts'])
: null,
aListOfDoubles: json['aListOfDoubles'] != null
? List<double>.from(json['aListOfDoubles'])
: null,
aListOfObjects: json['aListOfObjects'] != null
? List<ConvertedSimpleObject>.from(json['aListOfObjects']
.map((o) => ConvertedSimpleObject.fromJson(o)))
: null);
}
}

@ -0,0 +1,40 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
class ConvertedSimpleObject {
const ConvertedSimpleObject({
this.aString,
this.anInt,
this.aDouble,
this.aListOfStrings,
this.aListOfInts,
this.aListOfDoubles,
});
final String aString;
final int anInt;
final double aDouble;
final List<String> aListOfStrings;
final List<int> aListOfInts;
final List<double> aListOfDoubles;
factory ConvertedSimpleObject.fromJson(Map<String, dynamic> json) {
if (json == null) return null;
return ConvertedSimpleObject(
aString: json['aString'],
anInt: json['anInt'],
aDouble: json['aDouble'],
aListOfStrings: json['aListOfStrings'] != null
? List<String>.from(json['aListOfStrings'])
: null,
aListOfInts: json['aListOfInts'] != null
? List<int>.from(json['aListOfInts'])
: null,
aListOfDoubles: json['aListOfDoubles'] != null
? List<double>.from(json['aListOfDoubles'])
: null,
);
}
}

@ -0,0 +1,35 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:json_annotation/json_annotation.dart';
import 'package:jsonexample/json_serializable/serializable_simple_object.dart';
part 'serializable_complex_object.g.dart';
@JsonSerializable()
class SerializableComplexObject extends Object
with _$SerializableComplexObjectSerializerMixin {
SerializableComplexObject({
this.aString,
this.anInt,
this.aDouble,
this.anObject,
this.aListOfStrings,
this.aListOfInts,
this.aListOfDoubles,
this.aListOfObjects,
});
final String aString;
final int anInt;
final double aDouble;
final SerializableSimpleObject anObject;
final List<String> aListOfStrings;
final List<int> aListOfInts;
final List<double> aListOfDoubles;
final List<SerializableSimpleObject> aListOfObjects;
factory SerializableComplexObject.fromJson(Map<String, dynamic> json) =>
_$SerializableComplexObjectFromJson(json);
}

@ -0,0 +1,56 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'serializable_complex_object.dart';
// **************************************************************************
// Generator: JsonSerializableGenerator
// **************************************************************************
SerializableComplexObject _$SerializableComplexObjectFromJson(
Map<String, dynamic> json) =>
new SerializableComplexObject(
aString: json['aString'] as String,
anInt: json['anInt'] as int,
aDouble: (json['aDouble'] as num)?.toDouble(),
anObject: json['anObject'] == null
? null
: new SerializableSimpleObject.fromJson(
json['anObject'] as Map<String, dynamic>),
aListOfStrings:
(json['aListOfStrings'] as List)?.map((e) => e as String)?.toList(),
aListOfInts:
(json['aListOfInts'] as List)?.map((e) => e as int)?.toList(),
aListOfDoubles: (json['aListOfDoubles'] as List)
?.map((e) => (e as num)?.toDouble())
?.toList(),
aListOfObjects: (json['aListOfObjects'] as List)
?.map((e) => e == null
? null
: new SerializableSimpleObject.fromJson(
e as Map<String, dynamic>))
?.toList());
abstract class _$SerializableComplexObjectSerializerMixin {
String get aString;
int get anInt;
double get aDouble;
SerializableSimpleObject get anObject;
List<String> get aListOfStrings;
List<int> get aListOfInts;
List<double> get aListOfDoubles;
List<SerializableSimpleObject> get aListOfObjects;
Map<String, dynamic> toJson() => <String, dynamic>{
'aString': aString,
'anInt': anInt,
'aDouble': aDouble,
'anObject': anObject,
'aListOfStrings': aListOfStrings,
'aListOfInts': aListOfInts,
'aListOfDoubles': aListOfDoubles,
'aListOfObjects': aListOfObjects
};
}

@ -0,0 +1,32 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:json_annotation/json_annotation.dart';
part 'serializable_simple_object.g.dart';
/// An annotation for the code generator to know that this class needs the
/// JSON serialization logic to be generated.
@JsonSerializable()
class SerializableSimpleObject extends Object
with _$SerializableSimpleObjectSerializerMixin {
SerializableSimpleObject({
this.aString,
this.anInt,
this.aDouble,
this.aListOfStrings,
this.aListOfInts,
this.aListOfDoubles,
});
final String aString;
final int anInt;
final double aDouble;
final List<String> aListOfStrings;
final List<int> aListOfInts;
final List<double> aListOfDoubles;
factory SerializableSimpleObject.fromJson(Map<String, dynamic> json) =>
_$SerializableSimpleObjectFromJson(json);
}

@ -0,0 +1,42 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'serializable_simple_object.dart';
// **************************************************************************
// Generator: JsonSerializableGenerator
// **************************************************************************
SerializableSimpleObject _$SerializableSimpleObjectFromJson(
Map<String, dynamic> json) =>
new SerializableSimpleObject(
aString: json['aString'] as String,
anInt: json['anInt'] as int,
aDouble: (json['aDouble'] as num)?.toDouble(),
aListOfStrings:
(json['aListOfStrings'] as List)?.map((e) => e as String)?.toList(),
aListOfInts:
(json['aListOfInts'] as List)?.map((e) => e as int)?.toList(),
aListOfDoubles: (json['aListOfDoubles'] as List)
?.map((e) => (e as num)?.toDouble())
?.toList());
abstract class _$SerializableSimpleObjectSerializerMixin {
String get aString;
int get anInt;
double get aDouble;
List<String> get aListOfStrings;
List<int> get aListOfInts;
List<double> get aListOfDoubles;
Map<String, dynamic> toJson() => <String, dynamic>{
'aString': aString,
'anInt': anInt,
'aDouble': aDouble,
'aListOfStrings': aListOfStrings,
'aListOfInts': aListOfInts,
'aListOfDoubles': aListOfDoubles
};
}

@ -0,0 +1,267 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
abstract class JsonStrings {
static final String listOfInts = '[1, 2, 3]';
static final String listOfDoubles = '[1.0, 2.0, 3.0]';
static final String listOfStrings = '["one", "two", "three"]';
static final String listOfDynamics = '[1, "two", 3.0]';
static final String mapOfDynamics = '''
{
"anInt": 1,
"aString": "Blah, blah, blah.",
"aDouble": 1.0
}''';
static final String listOfSimpleObjects = '''
[
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
},
{
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
},
{
"aString": "Blah, blah, blah.",
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
},
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
},
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
},
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfDoubles": [1.0, 2.0, 3.0]
},
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3]
},
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": [],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
},
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [],
"aListOfDoubles": [1.0, 2.0, 3.0]
},
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": []
}
]
''';
static final List<String> simpleObjects = [
'''
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
}''',
'''
{
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
}''',
'''
{
"aString": "Blah, blah, blah.",
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
}''',
'''
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
}''',
'''
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
}''',
'''
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfDoubles": [1.0, 2.0, 3.0]
}''',
'''
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3]
}''',
'''
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": [],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
}''',
'''
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [],
"aListOfDoubles": [1.0, 2.0, 3.0]
}''',
'''
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": []
}''',
];
static final List<String> complexObjects = [
'''
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"anObject": {
"anInt": 1,
"aString": "Blah, blah, blah.",
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
},
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0],
"aListOfObjects": [
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
},
{
"aString": "Blah, blah, blah.",
"anInt": 2,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
},
{
"aString": "Blah, blah, blah.",
"anInt": 3,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
}
]
}''',
'''
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"anObject": {
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
},
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0],
"aListOfObjects": []
}''',
'''
{
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"anObject": {
"aString": "Blah, blah, blah.",
"anInt": 1,
"aDouble": 1.0,
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
},
"aListOfStrings": ["one", "two", "three"],
"aListOfInts": [1, 2, 3],
"aListOfDoubles": [1.0, 2.0, 3.0]
}''',
];
}

@ -0,0 +1,69 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:jsonexample/tab_pages.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
MyHomePage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 10,
child: Scaffold(
appBar: AppBar(
title: const Text('Let\'s parse some JSON'),
bottom: const TabBar(
isScrollable: true,
tabs: [
Tab(text: 'Basics'),
Tab(text: 'Conv. Simple'),
Tab(text: 'Conv. Complex'),
Tab(text: 'Conv. List'),
Tab(text: 'Ser. Simple'),
Tab(text: 'Ser. Complex'),
Tab(text: 'Ser. List'),
Tab(text: 'Built Simple'),
Tab(text: 'Built Complex'),
Tab(text: 'Built List'),
],
),
),
body: new SafeArea(
bottom: false,
child: TabBarView(
children: [
BasicsPage(),
ConvertedSimplePage(),
ConvertedComplexPage(),
ConvertedListPage(),
SerializableSimplePage(),
SerializableComplexPage(),
SerializableListPage(),
BuiltSimplePage(),
BuiltComplexPage(),
BuiltListPage(),
],
),
),
),
);
}
}

@ -0,0 +1,334 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:jsonexample/built_value/built_complex_object.dart';
import 'package:jsonexample/built_value/built_simple_object.dart';
import 'package:jsonexample/built_value/built_value_serializers.dart';
import 'package:jsonexample/dart_convert/converted_complex_object.dart';
import 'package:jsonexample/dart_convert/converted_simple_object.dart';
import 'package:jsonexample/json_serializable/serializable_complex_object.dart';
import 'package:jsonexample/json_serializable/serializable_simple_object.dart';
import 'package:jsonexample/json_strings.dart';
import 'package:jsonexample/utils.dart';
import 'package:jsonexample/widgets.dart';
class BasicsPage extends StatelessWidget {
List<TableRow> createMapRows(
Map<String, dynamic> values, TextStyle normalStyle, TextStyle boldStyle) {
return values.keys.map((k) {
return TableRow(
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0, bottom: 4.0),
child: Text(k, style: boldStyle),
),
Text(
values[k] is String ? '"${values[k]}"' : '${values[k]}',
style: normalStyle,
),
],
);
}).toList();
}
@override
Widget build(BuildContext context) {
final localTheme = Theme.of(context).textTheme;
final boldStyle = localTheme.body1.copyWith(fontWeight: FontWeight.w600);
final dynamicListOfInts = json.decode(JsonStrings.listOfInts);
final strongListOfInts = List<int>.from(dynamicListOfInts);
final dynamicListOfStrings = json.decode(JsonStrings.listOfStrings);
final strongListOfStrings = List<String>.from(dynamicListOfStrings);
final dynamicListOfDoubles = json.decode(JsonStrings.listOfDoubles);
final strongListOfDoubles = List<double>.from(dynamicListOfDoubles);
final dynamicListOfDynamics = json.decode(JsonStrings.listOfDynamics);
final strongListOfDynamics = List<dynamic>.from(dynamicListOfDynamics);
final dynamicMapOfDynamics = json.decode(JsonStrings.mapOfDynamics);
final strongMapOfDynamics = Map<String, dynamic>.from(dynamicMapOfDynamics);
return ListView(
padding: const EdgeInsets.all(16.0),
children: [
Table(
columnWidths: const {
0: IntrinsicColumnWidth(),
1: FlexColumnWidth(1.0),
},
children: [
TableRow(
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0, bottom: 4.0),
child: Text('List of ints:', style: boldStyle),
),
Text(
prettyPrintList(strongListOfInts),
style: localTheme.body1,
),
],
),
TableRow(
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0, bottom: 4.0),
child: Text('List of strings:', style: boldStyle),
),
Text(
prettyPrintList(strongListOfStrings),
style: localTheme.body1,
),
],
),
TableRow(
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0, bottom: 4.0),
child: Text('List of doubles:', style: boldStyle),
),
Text(
prettyPrintList(strongListOfDoubles),
style: localTheme.body1,
),
],
),
TableRow(
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0, bottom: 4.0),
child: Text('List of dynamic:', style: boldStyle),
),
Text(
prettyPrintList(strongListOfDynamics),
style: localTheme.body1,
),
],
),
TableRow(
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0, bottom: 8.0),
child: Text('Map of dynamics:', style: boldStyle),
),
Container(),
],
),
],
),
Padding(
padding: const EdgeInsets.only(left: 24.0),
child: Table(
columnWidths: const {
0: IntrinsicColumnWidth(),
1: FlexColumnWidth(1.0),
},
children: createMapRows(
strongMapOfDynamics,
localTheme.body1,
boldStyle,
),
),
),
],
);
}
}
class ConvertedSimplePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<ConvertedSimpleObject> objects = JsonStrings.simpleObjects.map(
(jsonString) {
final parsedJson = json.decode(jsonString);
return ConvertedSimpleObject.fromJson(parsedJson);
},
).toList();
return ListView(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
children: [
const SizedBox(height: 16.0),
SimpleObjectViewList(objects),
const SizedBox(height: 16.0),
],
);
}
}
class ConvertedComplexPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<ConvertedComplexObject> objects = JsonStrings.complexObjects.map(
(jsonString) {
final parsedJson = json.decode(jsonString);
return ConvertedComplexObject.fromJson(parsedJson);
},
).toList();
return ListView(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
children: [
const SizedBox(height: 16.0),
ComplexObjectViewList(objects),
const SizedBox(height: 16.0),
],
);
}
}
class ConvertedListPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final parsedJson = json.decode(JsonStrings.listOfSimpleObjects);
final deserializedObjects =
parsedJson.map((o) => ConvertedComplexObject.fromJson(o));
final listOfObjects = deserializedObjects.toList();
return ListView(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
children: [
const SizedBox(height: 16.0),
SimpleObjectViewList(listOfObjects),
const SizedBox(height: 16.0),
],
);
}
}
class SerializableSimplePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<SerializableSimpleObject> objects = JsonStrings.simpleObjects.map(
(jsonString) {
final parsedJson = json.decode(jsonString);
return SerializableSimpleObject.fromJson(parsedJson);
},
).toList();
return ListView(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
children: [
const SizedBox(height: 16.0),
SimpleObjectViewList(objects),
const SizedBox(height: 16.0),
],
);
}
}
class SerializableComplexPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<SerializableComplexObject> objects = JsonStrings.complexObjects.map(
(jsonString) {
final parsedJson = json.decode(jsonString);
return SerializableComplexObject.fromJson(parsedJson);
},
).toList();
return ListView(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
children: [
const SizedBox(height: 16.0),
ComplexObjectViewList(objects),
const SizedBox(height: 16.0),
],
);
}
}
class SerializableListPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final parsedJson = json.decode(JsonStrings.listOfSimpleObjects);
final deserializedObjects =
parsedJson.map((o) => SerializableSimpleObject.fromJson(o));
final listOfObjects = deserializedObjects.toList();
return ListView(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
children: [
const SizedBox(height: 16.0),
SimpleObjectViewList(listOfObjects),
const SizedBox(height: 16.0),
],
);
}
}
class BuiltSimplePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<BuiltSimpleObject> objects = JsonStrings.simpleObjects.map(
(jsonString) {
final parsedJson = json.decode(jsonString);
return serializers.deserializeWith(
BuiltSimpleObject.serializer, parsedJson);
},
).toList();
return ListView(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
children: [
const SizedBox(height: 16.0),
SimpleObjectViewList(objects),
const SizedBox(height: 16.0),
],
);
}
}
class BuiltComplexPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<BuiltComplexObject> objects = JsonStrings.complexObjects.map(
(jsonString) {
final parsedJson = json.decode(jsonString);
return serializers.deserializeWith(
BuiltComplexObject.serializer, parsedJson);
},
).toList();
return ListView(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
children: [
const SizedBox(height: 16.0),
ComplexObjectViewList(objects),
const SizedBox(height: 16.0),
],
);
}
}
class BuiltListPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final parsedJson = json.decode(JsonStrings.listOfSimpleObjects);
final deserializedObjects = parsedJson.map(
(o) => serializers.deserializeWith(BuiltComplexObject.serializer, o));
final listOfObjects = deserializedObjects.toList();
return ListView(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
children: [
const SizedBox(height: 16.0),
SimpleObjectViewList(listOfObjects),
const SizedBox(height: 16.0),
],
);
}
}

@ -0,0 +1,26 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
String prettyPrintList(Iterable iter) {
if (iter == null) return 'NULL';
final buff = StringBuffer();
var isFirst = true;
buff.write('[');
for (final val in iter) {
if (!isFirst) buff.write(', ');
isFirst = false;
if (val is String) {
buff.write('"$val"');
} else {
buff.write(val.toString());
}
}
buff.write(']');
return buff.toString();
}

@ -0,0 +1,291 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:jsonexample/utils.dart';
class SimpleObjectView extends StatelessWidget {
SimpleObjectView(dynamic obj) : simpleObject = obj;
final dynamic simpleObject;
@override
Widget build(BuildContext context) {
final localTheme = Theme.of(context).textTheme;
final boldStyle = localTheme.body1.copyWith(fontWeight: FontWeight.w600);
if (simpleObject == null) return Text('NULL', style: localTheme.body1);
return Table(
columnWidths: const {
0: IntrinsicColumnWidth(),
1: FlexColumnWidth(1.0),
},
children: [
TableRow(
children: [
Text(
'aString:',
style: boldStyle,
),
Text(
simpleObject.aString != null
? '"${simpleObject.aString}"'
: 'NULL',
style: localTheme.body1,
),
],
),
TableRow(
children: [
Text('anInt:', style: boldStyle),
Text(
simpleObject.anInt?.toString() ?? 'NULL',
style: localTheme.body1,
),
],
),
TableRow(children: [
Text('aDouble:', style: boldStyle),
Text(
simpleObject.aDouble?.toString() ?? 'NULL',
style: localTheme.body1,
),
]),
TableRow(
children: [
Text('aListOfStrings:', style: boldStyle),
Text(
prettyPrintList(
simpleObject.aListOfStrings,
),
style: localTheme.body1,
),
],
),
TableRow(
children: [
Text('aListOfInts:', style: boldStyle),
Text(
prettyPrintList(simpleObject.aListOfInts),
style: localTheme.body1,
),
],
),
TableRow(
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: Text('aListOfDoubles:', style: boldStyle),
),
Text(
prettyPrintList(simpleObject.aListOfDoubles),
style: localTheme.body1,
),
],
),
],
);
}
}
class SimpleObjectViewList extends StatelessWidget {
SimpleObjectViewList(List<dynamic> objects) : simpleObjects = objects;
final List<dynamic> simpleObjects;
@override
Widget build(BuildContext context) {
final widgets = <Widget>[];
for (int i = 0; i < simpleObjects.length; i++) {
widgets.addAll([
Text(
'SimpleObject $i:',
style: Theme.of(context).textTheme.subhead,
),
const SizedBox(height: 4.0),
SimpleObjectView(simpleObjects[i]),
const SizedBox(height: 24.0),
]);
}
widgets.removeLast();
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: widgets,
);
}
}
class ComplexObjectView extends StatelessWidget {
final dynamic complexObject;
ComplexObjectView(dynamic obj) : complexObject = obj;
List<Widget> _generateSimpleObjectWidgets(Iterable<dynamic> simpleObjects) {
if (simpleObjects == null) {
return [
const Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Text('NULL'),
),
];
}
if (simpleObjects.length == 0) {
return [
const Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Text('[]'),
),
];
}
return simpleObjects
.expand((o) => [
const SizedBox(height: 4.0),
SimpleObjectView(o),
const SizedBox(height: 4.0),
])
.toList();
}
@override
Widget build(BuildContext context) {
final localTheme = Theme.of(context).textTheme;
final boldStyle = localTheme.body1.copyWith(fontWeight: FontWeight.w600);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Table(
columnWidths: const {
0: IntrinsicColumnWidth(),
1: FlexColumnWidth(1.0),
},
children: [
TableRow(
children: [
Text('aString:', style: boldStyle),
Text(
complexObject.aString != null
? '"${complexObject.aString}"'
: 'NULL',
style: localTheme.body1),
],
),
TableRow(
children: [
Text('anInt:', style: boldStyle),
Text(complexObject.anInt?.toString() ?? 'NULL',
style: localTheme.body1),
],
),
TableRow(
children: [
Text('aDouble:', style: boldStyle),
Text(complexObject.aDouble?.toString() ?? 'NULL',
style: localTheme.body1),
],
),
TableRow(
children: [
Text('anObject:', style: boldStyle),
Container(),
],
),
],
),
Padding(
padding: const EdgeInsets.fromLTRB(24.0, 4.0, 0.0, 4.0),
child: SimpleObjectView(complexObject.anObject),
),
Table(
columnWidths: const {
0: IntrinsicColumnWidth(),
1: FlexColumnWidth(1.0),
},
children: [
TableRow(
children: [
Text('aListOfStrings:', style: boldStyle),
Text(
prettyPrintList(complexObject.aListOfStrings),
style: localTheme.body1,
),
],
),
TableRow(
children: [
Text('aListOfInts:', style: boldStyle),
Text(
prettyPrintList(complexObject.aListOfInts),
style: localTheme.body1,
),
],
),
TableRow(
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: Text('aListOfDoubles:', style: boldStyle),
),
Text(
prettyPrintList(complexObject.aListOfDoubles),
style: localTheme.body1,
),
],
),
TableRow(
children: [
Text('aListOfObjects:', style: boldStyle),
Container()
],
),
],
),
Padding(
padding: const EdgeInsets.only(left: 24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:
_generateSimpleObjectWidgets(complexObject.aListOfObjects),
),
),
],
);
}
}
class ComplexObjectViewList extends StatelessWidget {
ComplexObjectViewList(List<dynamic> objects) : complexObjects = objects;
final List<dynamic> complexObjects;
@override
Widget build(BuildContext context) {
final widgets = <Widget>[];
for (int i = 0; i < complexObjects.length; i++) {
widgets.addAll([
Text(
'Complex Object $i:',
style: Theme.of(context).textTheme.subhead,
),
const SizedBox(height: 4.0),
ComplexObjectView(complexObjects[i]),
const SizedBox(height: 24.0),
]);
}
widgets.removeLast();
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: widgets,
);
}
}

@ -0,0 +1,24 @@
name: jsonexample
description: A demonstration of JSON parsing
dependencies:
json_annotation: ^0.2.3
built_collection: '>=2.0.0 <4.0.0'
built_value: ^5.5.1
flutter:
sdk: flutter
dev_dependencies:
build_runner: ^0.8.0
json_serializable: ^0.5.0
built_value_generator: ^5.5.0
flutter_test:
sdk: flutter
flutter:
uses-material-design: true

@ -0,0 +1,9 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {});
}
Loading…
Cancel
Save