├── .gitignore ├── .vscode └── settings.json ├── LICENSE ├── README.md ├── dataclass ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── example │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── android │ │ ├── app │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── dataclass_example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── res │ │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ └── values │ │ │ │ │ └── styles.xml │ │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ └── gradle-wrapper.properties │ │ └── settings.gradle │ ├── ios │ │ ├── Flutter │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ └── Release.xcconfig │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ └── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── Runner │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ └── Runner-Bridging-Header.h │ ├── lib │ │ ├── example.dart │ │ ├── example.g.dart │ │ ├── generic_data.dart │ │ ├── generic_data.g.dart │ │ └── main.dart │ ├── pubspec.lock │ ├── pubspec.yaml │ └── test │ │ └── dataclass_test.dart ├── lib │ └── dataclass.dart ├── pubspec.lock └── pubspec.yaml └── dataclass_generator ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── build.yaml ├── lib └── dataclass_generator.dart ├── pubspec.lock └── pubspec.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | fvm -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "dart.flutterSdkPath": "/home/jbutajlo/fvm/default/" 3 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Jaroslaw Butajlo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DEPRECATED 2 | This package is no longer mantained. Consider using Freezed package to define your data classes. 3 | 4 | # dataclass 5 | 6 | [![License](https://img.shields.io/github/license/jarekb123/dart_dataclass?style=flat-square&logo=github)](https://github.com/jarekb123/dart_dataclass/blob/master/LICENSE) [![Github Stars](https://img.shields.io/github/stars/jarekb123/dart_dataclass?style=flat-square&logo=github)](https://github.com/jarekb123/dart_dataclass) 7 | 8 | ## Packages Versions on PUB 9 | * `dataclass` - ![Pub Version](https://img.shields.io/pub/v/dataclass) 10 | * `dataclass_generator` - ![Pub Version](https://img.shields.io/pub/v/dataclass_generator) 11 | 12 | `@DataClass` annotation used for dataclass_generator 13 | 14 | The DataClass generator generates base class for your data class with methods: 15 | 16 | - equals (operator ==) 17 | - hashCode 18 | - toString 19 | - copyWith 20 | 21 | ## Getting Started 22 | 23 | ### 0. Add dependencies to pubspec.yaml 24 | 25 | ```yaml 26 | dependencies: 27 | dataclass: latest_version 28 | dev_dependencies: 29 | dataclass_generator: latest_version 30 | ``` 31 | 32 | 33 | ### 1. Annotate your class with @dataClass 34 | 35 | The class should: 36 | 37 | - has only final fields 38 | - unnamed constructor with named parameters for all fields 39 | 40 | ```dart 41 | @dataClass 42 | class Car { 43 | final String name; 44 | final String manufacturer; 45 | final double price; 46 | 47 | Car({this.name, this.manufacturer, this.price}); 48 | } 49 | ``` 50 | 51 | ### 2. Generate dataclass base class 52 | 53 | Run `pub run build_runner build` 54 | 55 | #### Generated file 56 | 57 | ```dart 58 | abstract class _$Car { 59 | const _$Car(); 60 | 61 | String get name; 62 | String get manufacturer; 63 | double get price; 64 | bool operator ==(other) { 65 | if (identical(this, other)) return true; 66 | if (other is! Car) return false; 67 | 68 | return true && 69 | this.name == other.name && 70 | this.manufacturer == other.manufacturer && 71 | this.price == other.price; 72 | } 73 | 74 | int get hashCode { 75 | return mapPropsToHashCode([name, manufacturer, price]); 76 | } 77 | 78 | String toString() { 79 | return 'Car <\'name\': ${this.name},\'manufacturer\': ${this.manufacturer},\'price\': ${this.price},>'; 80 | } 81 | 82 | Car copyWith({String name, String manufacturer, double price}) { 83 | return Car( 84 | name: name ?? this.name, 85 | manufacturer: manufacturer ?? this.manufacturer, 86 | price: price ?? this.price, 87 | ); 88 | } 89 | } 90 | ``` 91 | 92 | ### 3. Extend class with generated base class 93 | 94 | ```dart 95 | @dataClass 96 | class Car extends _$Car { 97 | final String name; 98 | final String manufacturer; 99 | final double price; 100 | 101 | Car({this.name, this.manufacturer, this.price}); 102 | } 103 | ``` 104 | 105 | #### Collection equality 106 | ```dart 107 | 108 | @dataClass 109 | class Car extends _$Car { 110 | @Collection(deepEquality: true) // Short-hand: @Collection() 111 | final List parts; 112 | 113 | const Car({this.parts}); 114 | } 115 | ``` 116 | 117 | ## FAQ 118 | 119 | 1. Why you didn't use extension methods? 120 | 121 | As the docs says that: 122 | 123 | It is a compile-time error if an extension: 124 | 125 | - Declares a member with the same basename as a member declared by Object (==, hashCode, toString, noSuchMethod, runtimeType). This applies to both static and instance member declarations. 126 | 127 | 128 | 2. May I use generics? 129 | 130 | Yes. 131 | -------------------------------------------------------------------------------- /dataclass/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | build/ 31 | 32 | # Android related 33 | **/android/**/gradle-wrapper.jar 34 | **/android/.gradle 35 | **/android/captures/ 36 | **/android/gradlew 37 | **/android/gradlew.bat 38 | **/android/local.properties 39 | **/android/**/GeneratedPluginRegistrant.java 40 | 41 | # iOS/XCode related 42 | **/ios/**/*.mode1v3 43 | **/ios/**/*.mode2v3 44 | **/ios/**/*.moved-aside 45 | **/ios/**/*.pbxuser 46 | **/ios/**/*.perspectivev3 47 | **/ios/**/*sync/ 48 | **/ios/**/.sconsign.dblite 49 | **/ios/**/.tags* 50 | **/ios/**/.vagrant/ 51 | **/ios/**/DerivedData/ 52 | **/ios/**/Icon? 53 | **/ios/**/Pods/ 54 | **/ios/**/.symlinks/ 55 | **/ios/**/profile 56 | **/ios/**/xcuserdata 57 | **/ios/.generated/ 58 | **/ios/Flutter/App.framework 59 | **/ios/Flutter/Flutter.framework 60 | **/ios/Flutter/Generated.xcconfig 61 | **/ios/Flutter/app.flx 62 | **/ios/Flutter/app.zip 63 | **/ios/Flutter/flutter_assets/ 64 | **/ios/Flutter/flutter_export_environment.sh 65 | **/ios/ServiceDefinitions.json 66 | **/ios/Runner/GeneratedPluginRegistrant.* 67 | 68 | # Exceptions to above rules. 69 | !**/ios/**/default.mode1v3 70 | !**/ios/**/default.mode2v3 71 | !**/ios/**/default.pbxuser 72 | !**/ios/**/default.perspectivev3 73 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 74 | -------------------------------------------------------------------------------- /dataclass/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 68587a0916366e9512a78df22c44163d041dd5f3 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /dataclass/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.3.0+1] 2 | * Copy README from repository to `dataclass` directory 3 | 4 | ## [0.3.0] - 2019/01/19 5 | * Add @Collection() annotation to use DeepCollectionEquality from `collection` package to compare collections 6 | * Add `@dataClass` shorthand for `@DataClass()` 7 | 8 | ## [0.2.0] - 2019/12/25 9 | * enable usage of generic types, eg. `Product` 10 | * **BREAKING CHANGE**: change generated class name from `_Class` to `_$Class` 11 | * move example to `dataclass` package directory 12 | 13 | ## [0.1.0+1] - 2019/12/22 14 | * update README - badges 15 | 16 | ## [0.1.0] - 2019/12/22 17 | 18 | * `@DataClass()` annotation used by `dataclass_generator` 19 | * `mapPropsToHashCode` from `equatable` package used by `hashCode` getter 20 | -------------------------------------------------------------------------------- /dataclass/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Jaroslaw Butajlo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /dataclass/README.md: -------------------------------------------------------------------------------- 1 | # dataclass 2 | [![License](https://img.shields.io/github/license/jarekb123/dart_dataclass?style=flat-square&logo=github)](https://github.com/jarekb123/dart_dataclass/blob/master/LICENSE) [![Pub.dev](https://img.shields.io/pub/v/dataclass.svg?style=flat-square&logo=data:image/png;base64,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)](https://pub.dartlang.org/packages/dataclass) [![Github Stars](https://img.shields.io/github/stars/jarekb123/dart_dataclass?style=flat-square&logo=github)](https://github.com/jarekb123/dart_dataclass) 3 | 4 | `@DataClass` annotation used for dataclass_generator 5 | 6 | The DataClass generator generates base class for your data class with methods: 7 | 8 | - equals (operator ==) 9 | - hashCode 10 | - toString 11 | - copyWith 12 | 13 | ## Getting Started 14 | 15 | ### 0. Add dependencies to pubspec.yaml 16 | 17 | ```yaml 18 | dependencies: 19 | dataclass: latest_version 20 | dev_dependencies: 21 | dataclass_generator: latest_version 22 | ``` 23 | 24 | ### 1. Annotate your class with @dataClass 25 | 26 | The class should: 27 | 28 | - has only final fields 29 | - unnamed constructor with named parameters for all fields 30 | 31 | ```dart 32 | @dataClass 33 | class Car { 34 | final String name; 35 | final String manufacturer; 36 | final double price; 37 | 38 | Car({this.name, this.manufacturer, this.price}); 39 | } 40 | ``` 41 | 42 | ### 2. Generate dataclass base class 43 | 44 | Run `pub run build_runner build` 45 | 46 | #### Generated file 47 | 48 | ```dart 49 | abstract class _$Car { 50 | const _$Car(); 51 | 52 | String get name; 53 | String get manufacturer; 54 | double get price; 55 | bool operator ==(other) { 56 | if (identical(this, other)) return true; 57 | if (other is! Car) return false; 58 | 59 | return true && 60 | this.name == other.name && 61 | this.manufacturer == other.manufacturer && 62 | this.price == other.price; 63 | } 64 | 65 | int get hashCode { 66 | return mapPropsToHashCode([name, manufacturer, price]); 67 | } 68 | 69 | String toString() { 70 | return 'Car <\'name\': ${this.name},\'manufacturer\': ${this.manufacturer},\'price\': ${this.price},>'; 71 | } 72 | 73 | Car copyWith({String name, String manufacturer, double price}) { 74 | return Car( 75 | name: name ?? this.name, 76 | manufacturer: manufacturer ?? this.manufacturer, 77 | price: price ?? this.price, 78 | ); 79 | } 80 | } 81 | ``` 82 | 83 | ### 3. Extend class with generated base class 84 | 85 | ```dart 86 | @dataClass 87 | class Car extends _$Car { 88 | final String name; 89 | final String manufacturer; 90 | final double price; 91 | 92 | Car({this.name, this.manufacturer, this.price}); 93 | } 94 | ``` 95 | 96 | #### Collection equality 97 | ```dart 98 | 99 | @dataClass 100 | class Car extends _$Car { 101 | @Collection(deepEquality: true) // Short-hand: @Collection() 102 | final List parts; 103 | 104 | const Car({this.parts}); 105 | } 106 | ``` 107 | 108 | ## FAQ 109 | 110 | 1. Why you didn't use extension methods? 111 | 112 | As the docs says that: 113 | 114 | It is a compile-time error if an extension: 115 | 116 | - Declares a member with the same basename as a member declared by Object (==, hashCode, toString, noSuchMethod, runtimeType). This applies to both static and instance member declarations. 117 | 118 | 119 | 2. May I use generics? 120 | 121 | Yes. -------------------------------------------------------------------------------- /dataclass/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | /build/ 31 | 32 | # Android related 33 | **/android/**/gradle-wrapper.jar 34 | **/android/.gradle 35 | **/android/captures/ 36 | **/android/gradlew 37 | **/android/gradlew.bat 38 | **/android/local.properties 39 | **/android/**/GeneratedPluginRegistrant.java 40 | 41 | # iOS/XCode related 42 | **/ios/**/*.mode1v3 43 | **/ios/**/*.mode2v3 44 | **/ios/**/*.moved-aside 45 | **/ios/**/*.pbxuser 46 | **/ios/**/*.perspectivev3 47 | **/ios/**/*sync/ 48 | **/ios/**/.sconsign.dblite 49 | **/ios/**/.tags* 50 | **/ios/**/.vagrant/ 51 | **/ios/**/DerivedData/ 52 | **/ios/**/Icon? 53 | **/ios/**/Pods/ 54 | **/ios/**/.symlinks/ 55 | **/ios/**/profile 56 | **/ios/**/xcuserdata 57 | **/ios/.generated/ 58 | **/ios/Flutter/App.framework 59 | **/ios/Flutter/Flutter.framework 60 | **/ios/Flutter/Generated.xcconfig 61 | **/ios/Flutter/app.flx 62 | **/ios/Flutter/app.zip 63 | **/ios/Flutter/flutter_assets/ 64 | **/ios/Flutter/flutter_export_environment.sh 65 | **/ios/ServiceDefinitions.json 66 | **/ios/Runner/GeneratedPluginRegistrant.* 67 | 68 | # Exceptions to above rules. 69 | !**/ios/**/default.mode1v3 70 | !**/ios/**/default.mode2v3 71 | !**/ios/**/default.pbxuser 72 | !**/ios/**/default.perspectivev3 73 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 74 | -------------------------------------------------------------------------------- /dataclass/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 68587a0916366e9512a78df22c44163d041dd5f3 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /dataclass/example/README.md: -------------------------------------------------------------------------------- 1 | # dataclass_example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /dataclass/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.dataclass_example" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 66 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 67 | } 68 | -------------------------------------------------------------------------------- /dataclass/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /dataclass/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /dataclass/example/android/app/src/main/kotlin/com/example/dataclass_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.dataclass_example 2 | 3 | import android.os.Bundle 4 | 5 | import io.flutter.app.FlutterActivity 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | GeneratedPluginRegistrant.registerWith(this) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /dataclass/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /dataclass/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /dataclass/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /dataclass/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /dataclass/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /dataclass/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /dataclass/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /dataclass/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /dataclass/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.2.71' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.2.1' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /dataclass/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | 3 | -------------------------------------------------------------------------------- /dataclass/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /dataclass/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /dataclass/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /dataclass/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /dataclass/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /dataclass/example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 18 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 19 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 20 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXCopyFilesBuildPhase section */ 24 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 25 | isa = PBXCopyFilesBuildPhase; 26 | buildActionMask = 2147483647; 27 | dstPath = ""; 28 | dstSubfolderSpec = 10; 29 | files = ( 30 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 31 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 32 | ); 33 | name = "Embed Frameworks"; 34 | runOnlyForDeploymentPostprocessing = 0; 35 | }; 36 | /* End PBXCopyFilesBuildPhase section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 40 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 41 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 42 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 43 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 44 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 45 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 46 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 47 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 48 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 49 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 51 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 52 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 53 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 62 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | /* End PBXFrameworksBuildPhase section */ 67 | 68 | /* Begin PBXGroup section */ 69 | 9740EEB11CF90186004384FC /* Flutter */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 3B80C3931E831B6300D905FE /* App.framework */, 73 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 74 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 75 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 76 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 77 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 78 | ); 79 | name = Flutter; 80 | sourceTree = ""; 81 | }; 82 | 97C146E51CF9000F007C117D = { 83 | isa = PBXGroup; 84 | children = ( 85 | 9740EEB11CF90186004384FC /* Flutter */, 86 | 97C146F01CF9000F007C117D /* Runner */, 87 | 97C146EF1CF9000F007C117D /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | 97C146EF1CF9000F007C117D /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 97C146EE1CF9000F007C117D /* Runner.app */, 95 | ); 96 | name = Products; 97 | sourceTree = ""; 98 | }; 99 | 97C146F01CF9000F007C117D /* Runner */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 103 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 104 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 105 | 97C147021CF9000F007C117D /* Info.plist */, 106 | 97C146F11CF9000F007C117D /* Supporting Files */, 107 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 108 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 109 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 110 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 111 | ); 112 | path = Runner; 113 | sourceTree = ""; 114 | }; 115 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | ); 119 | name = "Supporting Files"; 120 | sourceTree = ""; 121 | }; 122 | /* End PBXGroup section */ 123 | 124 | /* Begin PBXNativeTarget section */ 125 | 97C146ED1CF9000F007C117D /* Runner */ = { 126 | isa = PBXNativeTarget; 127 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 128 | buildPhases = ( 129 | 9740EEB61CF901F6004384FC /* Run Script */, 130 | 97C146EA1CF9000F007C117D /* Sources */, 131 | 97C146EB1CF9000F007C117D /* Frameworks */, 132 | 97C146EC1CF9000F007C117D /* Resources */, 133 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 134 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 135 | ); 136 | buildRules = ( 137 | ); 138 | dependencies = ( 139 | ); 140 | name = Runner; 141 | productName = Runner; 142 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 143 | productType = "com.apple.product-type.application"; 144 | }; 145 | /* End PBXNativeTarget section */ 146 | 147 | /* Begin PBXProject section */ 148 | 97C146E61CF9000F007C117D /* Project object */ = { 149 | isa = PBXProject; 150 | attributes = { 151 | LastUpgradeCheck = 1020; 152 | ORGANIZATIONNAME = "The Chromium Authors"; 153 | TargetAttributes = { 154 | 97C146ED1CF9000F007C117D = { 155 | CreatedOnToolsVersion = 7.3.1; 156 | LastSwiftMigration = 0910; 157 | }; 158 | }; 159 | }; 160 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 161 | compatibilityVersion = "Xcode 3.2"; 162 | developmentRegion = en; 163 | hasScannedForEncodings = 0; 164 | knownRegions = ( 165 | en, 166 | Base, 167 | ); 168 | mainGroup = 97C146E51CF9000F007C117D; 169 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 170 | projectDirPath = ""; 171 | projectRoot = ""; 172 | targets = ( 173 | 97C146ED1CF9000F007C117D /* Runner */, 174 | ); 175 | }; 176 | /* End PBXProject section */ 177 | 178 | /* Begin PBXResourcesBuildPhase section */ 179 | 97C146EC1CF9000F007C117D /* Resources */ = { 180 | isa = PBXResourcesBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 184 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 185 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 186 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 187 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 188 | ); 189 | runOnlyForDeploymentPostprocessing = 0; 190 | }; 191 | /* End PBXResourcesBuildPhase section */ 192 | 193 | /* Begin PBXShellScriptBuildPhase section */ 194 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 195 | isa = PBXShellScriptBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | inputPaths = ( 200 | ); 201 | name = "Thin Binary"; 202 | outputPaths = ( 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | shellPath = /bin/sh; 206 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 207 | }; 208 | 9740EEB61CF901F6004384FC /* Run Script */ = { 209 | isa = PBXShellScriptBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | ); 213 | inputPaths = ( 214 | ); 215 | name = "Run Script"; 216 | outputPaths = ( 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | shellPath = /bin/sh; 220 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 221 | }; 222 | /* End PBXShellScriptBuildPhase section */ 223 | 224 | /* Begin PBXSourcesBuildPhase section */ 225 | 97C146EA1CF9000F007C117D /* Sources */ = { 226 | isa = PBXSourcesBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 230 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | /* End PBXSourcesBuildPhase section */ 235 | 236 | /* Begin PBXVariantGroup section */ 237 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 238 | isa = PBXVariantGroup; 239 | children = ( 240 | 97C146FB1CF9000F007C117D /* Base */, 241 | ); 242 | name = Main.storyboard; 243 | sourceTree = ""; 244 | }; 245 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 246 | isa = PBXVariantGroup; 247 | children = ( 248 | 97C147001CF9000F007C117D /* Base */, 249 | ); 250 | name = LaunchScreen.storyboard; 251 | sourceTree = ""; 252 | }; 253 | /* End PBXVariantGroup section */ 254 | 255 | /* Begin XCBuildConfiguration section */ 256 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 257 | isa = XCBuildConfiguration; 258 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 259 | buildSettings = { 260 | ALWAYS_SEARCH_USER_PATHS = NO; 261 | CLANG_ANALYZER_NONNULL = YES; 262 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 263 | CLANG_CXX_LIBRARY = "libc++"; 264 | CLANG_ENABLE_MODULES = YES; 265 | CLANG_ENABLE_OBJC_ARC = YES; 266 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 267 | CLANG_WARN_BOOL_CONVERSION = YES; 268 | CLANG_WARN_COMMA = YES; 269 | CLANG_WARN_CONSTANT_CONVERSION = YES; 270 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 271 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 272 | CLANG_WARN_EMPTY_BODY = YES; 273 | CLANG_WARN_ENUM_CONVERSION = YES; 274 | CLANG_WARN_INFINITE_RECURSION = YES; 275 | CLANG_WARN_INT_CONVERSION = YES; 276 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 277 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 278 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 279 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 280 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 281 | CLANG_WARN_STRICT_PROTOTYPES = YES; 282 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 283 | CLANG_WARN_UNREACHABLE_CODE = YES; 284 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 285 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 286 | COPY_PHASE_STRIP = NO; 287 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 288 | ENABLE_NS_ASSERTIONS = NO; 289 | ENABLE_STRICT_OBJC_MSGSEND = YES; 290 | GCC_C_LANGUAGE_STANDARD = gnu99; 291 | GCC_NO_COMMON_BLOCKS = YES; 292 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 293 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 294 | GCC_WARN_UNDECLARED_SELECTOR = YES; 295 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 296 | GCC_WARN_UNUSED_FUNCTION = YES; 297 | GCC_WARN_UNUSED_VARIABLE = YES; 298 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 299 | MTL_ENABLE_DEBUG_INFO = NO; 300 | SDKROOT = iphoneos; 301 | TARGETED_DEVICE_FAMILY = "1,2"; 302 | VALIDATE_PRODUCT = YES; 303 | }; 304 | name = Profile; 305 | }; 306 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 307 | isa = XCBuildConfiguration; 308 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 309 | buildSettings = { 310 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 311 | CLANG_ENABLE_MODULES = YES; 312 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 313 | ENABLE_BITCODE = NO; 314 | FRAMEWORK_SEARCH_PATHS = ( 315 | "$(inherited)", 316 | "$(PROJECT_DIR)/Flutter", 317 | ); 318 | INFOPLIST_FILE = Runner/Info.plist; 319 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 320 | LIBRARY_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "$(PROJECT_DIR)/Flutter", 323 | ); 324 | PRODUCT_BUNDLE_IDENTIFIER = com.example.dataclassExample; 325 | PRODUCT_NAME = "$(TARGET_NAME)"; 326 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 327 | SWIFT_VERSION = 4.0; 328 | VERSIONING_SYSTEM = "apple-generic"; 329 | }; 330 | name = Profile; 331 | }; 332 | 97C147031CF9000F007C117D /* Debug */ = { 333 | isa = XCBuildConfiguration; 334 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 335 | buildSettings = { 336 | ALWAYS_SEARCH_USER_PATHS = NO; 337 | CLANG_ANALYZER_NONNULL = YES; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 343 | CLANG_WARN_BOOL_CONVERSION = YES; 344 | CLANG_WARN_COMMA = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 347 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 348 | CLANG_WARN_EMPTY_BODY = YES; 349 | CLANG_WARN_ENUM_CONVERSION = YES; 350 | CLANG_WARN_INFINITE_RECURSION = YES; 351 | CLANG_WARN_INT_CONVERSION = YES; 352 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 354 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 355 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 356 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 357 | CLANG_WARN_STRICT_PROTOTYPES = YES; 358 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 359 | CLANG_WARN_UNREACHABLE_CODE = YES; 360 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 361 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 362 | COPY_PHASE_STRIP = NO; 363 | DEBUG_INFORMATION_FORMAT = dwarf; 364 | ENABLE_STRICT_OBJC_MSGSEND = YES; 365 | ENABLE_TESTABILITY = YES; 366 | GCC_C_LANGUAGE_STANDARD = gnu99; 367 | GCC_DYNAMIC_NO_PIC = NO; 368 | GCC_NO_COMMON_BLOCKS = YES; 369 | GCC_OPTIMIZATION_LEVEL = 0; 370 | GCC_PREPROCESSOR_DEFINITIONS = ( 371 | "DEBUG=1", 372 | "$(inherited)", 373 | ); 374 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 375 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 376 | GCC_WARN_UNDECLARED_SELECTOR = YES; 377 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 378 | GCC_WARN_UNUSED_FUNCTION = YES; 379 | GCC_WARN_UNUSED_VARIABLE = YES; 380 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 381 | MTL_ENABLE_DEBUG_INFO = YES; 382 | ONLY_ACTIVE_ARCH = YES; 383 | SDKROOT = iphoneos; 384 | TARGETED_DEVICE_FAMILY = "1,2"; 385 | }; 386 | name = Debug; 387 | }; 388 | 97C147041CF9000F007C117D /* Release */ = { 389 | isa = XCBuildConfiguration; 390 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 391 | buildSettings = { 392 | ALWAYS_SEARCH_USER_PATHS = NO; 393 | CLANG_ANALYZER_NONNULL = YES; 394 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 395 | CLANG_CXX_LIBRARY = "libc++"; 396 | CLANG_ENABLE_MODULES = YES; 397 | CLANG_ENABLE_OBJC_ARC = YES; 398 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 399 | CLANG_WARN_BOOL_CONVERSION = YES; 400 | CLANG_WARN_COMMA = YES; 401 | CLANG_WARN_CONSTANT_CONVERSION = YES; 402 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 403 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 404 | CLANG_WARN_EMPTY_BODY = YES; 405 | CLANG_WARN_ENUM_CONVERSION = YES; 406 | CLANG_WARN_INFINITE_RECURSION = YES; 407 | CLANG_WARN_INT_CONVERSION = YES; 408 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 409 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 413 | CLANG_WARN_STRICT_PROTOTYPES = YES; 414 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 415 | CLANG_WARN_UNREACHABLE_CODE = YES; 416 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 417 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 418 | COPY_PHASE_STRIP = NO; 419 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 420 | ENABLE_NS_ASSERTIONS = NO; 421 | ENABLE_STRICT_OBJC_MSGSEND = YES; 422 | GCC_C_LANGUAGE_STANDARD = gnu99; 423 | GCC_NO_COMMON_BLOCKS = YES; 424 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 425 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 426 | GCC_WARN_UNDECLARED_SELECTOR = YES; 427 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 428 | GCC_WARN_UNUSED_FUNCTION = YES; 429 | GCC_WARN_UNUSED_VARIABLE = YES; 430 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 431 | MTL_ENABLE_DEBUG_INFO = NO; 432 | SDKROOT = iphoneos; 433 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 434 | TARGETED_DEVICE_FAMILY = "1,2"; 435 | VALIDATE_PRODUCT = YES; 436 | }; 437 | name = Release; 438 | }; 439 | 97C147061CF9000F007C117D /* Debug */ = { 440 | isa = XCBuildConfiguration; 441 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 442 | buildSettings = { 443 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 444 | CLANG_ENABLE_MODULES = YES; 445 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 446 | ENABLE_BITCODE = NO; 447 | FRAMEWORK_SEARCH_PATHS = ( 448 | "$(inherited)", 449 | "$(PROJECT_DIR)/Flutter", 450 | ); 451 | INFOPLIST_FILE = Runner/Info.plist; 452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 453 | LIBRARY_SEARCH_PATHS = ( 454 | "$(inherited)", 455 | "$(PROJECT_DIR)/Flutter", 456 | ); 457 | PRODUCT_BUNDLE_IDENTIFIER = com.example.dataclassExample; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 460 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 461 | SWIFT_VERSION = 4.0; 462 | VERSIONING_SYSTEM = "apple-generic"; 463 | }; 464 | name = Debug; 465 | }; 466 | 97C147071CF9000F007C117D /* Release */ = { 467 | isa = XCBuildConfiguration; 468 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 469 | buildSettings = { 470 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 471 | CLANG_ENABLE_MODULES = YES; 472 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 473 | ENABLE_BITCODE = NO; 474 | FRAMEWORK_SEARCH_PATHS = ( 475 | "$(inherited)", 476 | "$(PROJECT_DIR)/Flutter", 477 | ); 478 | INFOPLIST_FILE = Runner/Info.plist; 479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 480 | LIBRARY_SEARCH_PATHS = ( 481 | "$(inherited)", 482 | "$(PROJECT_DIR)/Flutter", 483 | ); 484 | PRODUCT_BUNDLE_IDENTIFIER = com.example.dataclassExample; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 487 | SWIFT_VERSION = 4.0; 488 | VERSIONING_SYSTEM = "apple-generic"; 489 | }; 490 | name = Release; 491 | }; 492 | /* End XCBuildConfiguration section */ 493 | 494 | /* Begin XCConfigurationList section */ 495 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 496 | isa = XCConfigurationList; 497 | buildConfigurations = ( 498 | 97C147031CF9000F007C117D /* Debug */, 499 | 97C147041CF9000F007C117D /* Release */, 500 | 249021D3217E4FDB00AE95B9 /* Profile */, 501 | ); 502 | defaultConfigurationIsVisible = 0; 503 | defaultConfigurationName = Release; 504 | }; 505 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 506 | isa = XCConfigurationList; 507 | buildConfigurations = ( 508 | 97C147061CF9000F007C117D /* Debug */, 509 | 97C147071CF9000F007C117D /* Release */, 510 | 249021D4217E4FDB00AE95B9 /* Profile */, 511 | ); 512 | defaultConfigurationIsVisible = 0; 513 | defaultConfigurationName = Release; 514 | }; 515 | /* End XCConfigurationList section */ 516 | 517 | }; 518 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 519 | } 520 | -------------------------------------------------------------------------------- /dataclass/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /dataclass/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /dataclass/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jarekb123/dart_dataclass/5f969c24bd6ce56a48f5e632ad459032d615aa16/dataclass/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | dataclass_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /dataclass/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /dataclass/example/lib/example.dart: -------------------------------------------------------------------------------- 1 | import 'package:dataclass/dataclass.dart'; 2 | 3 | part 'example.g.dart'; 4 | 5 | @dataClass 6 | class Data extends _$Data { 7 | final int id; 8 | final String name; 9 | 10 | const Data({this.id, this.name}); 11 | } 12 | 13 | @dataClass 14 | class Car extends _$Car { 15 | final String name; 16 | final String manufacturer; 17 | final double price; 18 | 19 | Car({this.name, this.manufacturer, this.price}); 20 | } 21 | 22 | @dataClass 23 | class NoFieldsClass extends _$NoFieldsClass {} 24 | 25 | @dataClass 26 | class Manufacturer extends _$Manufacturer { 27 | @Collection() 28 | final List cars; 29 | 30 | Manufacturer({this.cars}); 31 | } 32 | -------------------------------------------------------------------------------- /dataclass/example/lib/example.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'example.dart'; 4 | 5 | // ************************************************************************** 6 | // DataClassGenerator 7 | // ************************************************************************** 8 | 9 | abstract class _$Data { 10 | const _$Data(); 11 | 12 | int get id; 13 | String get name; 14 | bool operator ==(other) { 15 | if (identical(this, other)) return true; 16 | if (other is! Data) return false; 17 | 18 | return true && this.id == other.id && this.name == other.name; 19 | } 20 | 21 | int get hashCode { 22 | return mapPropsToHashCode([id, name]); 23 | } 24 | 25 | String toString() { 26 | return 'Data <\'id\': ${this.id},\'name\': ${this.name},>'; 27 | } 28 | 29 | Data copyWith({int id, String name}) { 30 | return Data( 31 | id: id ?? this.id, 32 | name: name ?? this.name, 33 | ); 34 | } 35 | } 36 | 37 | abstract class _$Car { 38 | const _$Car(); 39 | 40 | String get name; 41 | String get manufacturer; 42 | double get price; 43 | bool operator ==(other) { 44 | if (identical(this, other)) return true; 45 | if (other is! Car) return false; 46 | 47 | return true && 48 | this.name == other.name && 49 | this.manufacturer == other.manufacturer && 50 | this.price == other.price; 51 | } 52 | 53 | int get hashCode { 54 | return mapPropsToHashCode([name, manufacturer, price]); 55 | } 56 | 57 | String toString() { 58 | return 'Car <\'name\': ${this.name},\'manufacturer\': ${this.manufacturer},\'price\': ${this.price},>'; 59 | } 60 | 61 | Car copyWith({String name, String manufacturer, double price}) { 62 | return Car( 63 | name: name ?? this.name, 64 | manufacturer: manufacturer ?? this.manufacturer, 65 | price: price ?? this.price, 66 | ); 67 | } 68 | } 69 | 70 | abstract class _$NoFieldsClass { 71 | const _$NoFieldsClass(); 72 | 73 | bool operator ==(other) { 74 | if (identical(this, other)) return true; 75 | if (other is! NoFieldsClass) return false; 76 | 77 | return true; 78 | } 79 | 80 | int get hashCode { 81 | return mapPropsToHashCode([]); 82 | } 83 | 84 | String toString() { 85 | return 'NoFieldsClass <>'; 86 | } 87 | 88 | NoFieldsClass copyWith() { 89 | return NoFieldsClass(); 90 | } 91 | } 92 | 93 | abstract class _$Manufacturer { 94 | const _$Manufacturer(); 95 | 96 | List get cars; 97 | bool operator ==(other) { 98 | if (identical(this, other)) return true; 99 | if (other is! Manufacturer) return false; 100 | 101 | return true && this.cars == other.cars; 102 | } 103 | 104 | int get hashCode { 105 | return mapPropsToHashCode([cars]); 106 | } 107 | 108 | String toString() { 109 | return 'Manufacturer <\'cars\': ${this.cars},>'; 110 | } 111 | 112 | Manufacturer copyWith({List cars}) { 113 | return Manufacturer( 114 | cars: cars ?? this.cars, 115 | ); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /dataclass/example/lib/generic_data.dart: -------------------------------------------------------------------------------- 1 | import 'package:dataclass/dataclass.dart'; 2 | 3 | part 'generic_data.g.dart'; 4 | 5 | @DataClass() 6 | class Product extends _$Product { 7 | final String name; 8 | final T price; 9 | 10 | const Product({this.name, this.price}); 11 | } 12 | 13 | @DataClass() 14 | class Category extends _$Category { 15 | final List> products; 16 | 17 | const Category({this.products}); 18 | } 19 | -------------------------------------------------------------------------------- /dataclass/example/lib/generic_data.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'generic_data.dart'; 4 | 5 | // ************************************************************************** 6 | // DataClassGenerator 7 | // ************************************************************************** 8 | 9 | abstract class _$Product { 10 | const _$Product(); 11 | 12 | String get name; 13 | T get price; 14 | bool operator ==(other) { 15 | if (identical(this, other)) return true; 16 | if (other is! Product) return false; 17 | 18 | return true && this.name == other.name && this.price == other.price; 19 | } 20 | 21 | int get hashCode { 22 | return mapPropsToHashCode([name, price]); 23 | } 24 | 25 | String toString() { 26 | return 'Product <\'name\': ${this.name},\'price\': ${this.price},>'; 27 | } 28 | 29 | Product copyWith({String name, T price}) { 30 | return Product( 31 | name: name ?? this.name, 32 | price: price ?? this.price, 33 | ); 34 | } 35 | } 36 | 37 | abstract class _$Category { 38 | const _$Category(); 39 | 40 | List> get products; 41 | bool operator ==(other) { 42 | if (identical(this, other)) return true; 43 | if (other is! Category) return false; 44 | 45 | return true && this.products == other.products; 46 | } 47 | 48 | int get hashCode { 49 | return mapPropsToHashCode([products]); 50 | } 51 | 52 | String toString() { 53 | return 'Category <\'products\': ${this.products},>'; 54 | } 55 | 56 | Category copyWith({List> products}) { 57 | return Category( 58 | products: products ?? this.products, 59 | ); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /dataclass/example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | void main() => runApp(MyApp()); 4 | 5 | class MyApp extends StatelessWidget { 6 | // This widget is the root of your application. 7 | @override 8 | Widget build(BuildContext context) { 9 | return MaterialApp( 10 | title: 'Flutter Demo', 11 | theme: ThemeData( 12 | // This is the theme of your application. 13 | // 14 | // Try running your application with "flutter run". You'll see the 15 | // application has a blue toolbar. Then, without quitting the app, try 16 | // changing the primarySwatch below to Colors.green and then invoke 17 | // "hot reload" (press "r" in the console where you ran "flutter run", 18 | // or simply save your changes to "hot reload" in a Flutter IDE). 19 | // Notice that the counter didn't reset back to zero; the application 20 | // is not restarted. 21 | primarySwatch: Colors.blue, 22 | ), 23 | home: MyHomePage(title: 'Flutter Demo Home Page'), 24 | ); 25 | } 26 | } 27 | 28 | class MyHomePage extends StatefulWidget { 29 | MyHomePage({Key key, this.title}) : super(key: key); 30 | 31 | // This widget is the home page of your application. It is stateful, meaning 32 | // that it has a State object (defined below) that contains fields that affect 33 | // how it looks. 34 | 35 | // This class is the configuration for the state. It holds the values (in this 36 | // case the title) provided by the parent (in this case the App widget) and 37 | // used by the build method of the State. Fields in a Widget subclass are 38 | // always marked "final". 39 | 40 | final String title; 41 | 42 | @override 43 | _MyHomePageState createState() => _MyHomePageState(); 44 | } 45 | 46 | class _MyHomePageState extends State { 47 | int _counter = 0; 48 | 49 | void _incrementCounter() { 50 | setState(() { 51 | // This call to setState tells the Flutter framework that something has 52 | // changed in this State, which causes it to rerun the build method below 53 | // so that the display can reflect the updated values. If we changed 54 | // _counter without calling setState(), then the build method would not be 55 | // called again, and so nothing would appear to happen. 56 | _counter++; 57 | }); 58 | } 59 | 60 | @override 61 | Widget build(BuildContext context) { 62 | // This method is rerun every time setState is called, for instance as done 63 | // by the _incrementCounter method above. 64 | // 65 | // The Flutter framework has been optimized to make rerunning build methods 66 | // fast, so that you can just rebuild anything that needs updating rather 67 | // than having to individually change instances of widgets. 68 | return Scaffold( 69 | appBar: AppBar( 70 | // Here we take the value from the MyHomePage object that was created by 71 | // the App.build method, and use it to set our appbar title. 72 | title: Text(widget.title), 73 | ), 74 | body: Center( 75 | // Center is a layout widget. It takes a single child and positions it 76 | // in the middle of the parent. 77 | child: Column( 78 | // Column is also a layout widget. It takes a list of children and 79 | // arranges them vertically. By default, it sizes itself to fit its 80 | // children horizontally, and tries to be as tall as its parent. 81 | // 82 | // Invoke "debug painting" (press "p" in the console, choose the 83 | // "Toggle Debug Paint" action from the Flutter Inspector in Android 84 | // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) 85 | // to see the wireframe for each widget. 86 | // 87 | // Column has various properties to control how it sizes itself and 88 | // how it positions its children. Here we use mainAxisAlignment to 89 | // center the children vertically; the main axis here is the vertical 90 | // axis because Columns are vertical (the cross axis would be 91 | // horizontal). 92 | mainAxisAlignment: MainAxisAlignment.center, 93 | children: [ 94 | Text( 95 | 'You have pushed the button this many times:', 96 | ), 97 | Text( 98 | '$_counter', 99 | style: Theme.of(context).textTheme.display1, 100 | ), 101 | ], 102 | ), 103 | ), 104 | floatingActionButton: FloatingActionButton( 105 | onPressed: _incrementCounter, 106 | tooltip: 'Increment', 107 | child: Icon(Icons.add), 108 | ), // This trailing comma makes auto-formatting nicer for build methods. 109 | ); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /dataclass/example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _fe_analyzer_shared: 5 | dependency: transitive 6 | description: 7 | name: _fe_analyzer_shared 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "1.0.3" 11 | analyzer: 12 | dependency: transitive 13 | description: 14 | name: analyzer 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "0.39.4" 18 | args: 19 | dependency: transitive 20 | description: 21 | name: args 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.5.2" 25 | async: 26 | dependency: transitive 27 | description: 28 | name: async 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.5.0-nullsafety.1" 32 | boolean_selector: 33 | dependency: transitive 34 | description: 35 | name: boolean_selector 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "2.1.0-nullsafety.1" 39 | build: 40 | dependency: transitive 41 | description: 42 | name: build 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.2.2" 46 | build_config: 47 | dependency: transitive 48 | description: 49 | name: build_config 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "0.4.1+1" 53 | build_daemon: 54 | dependency: transitive 55 | description: 56 | name: build_daemon 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.3" 60 | build_resolvers: 61 | dependency: transitive 62 | description: 63 | name: build_resolvers 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.3.1" 67 | build_runner: 68 | dependency: "direct dev" 69 | description: 70 | name: build_runner 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.7.3" 74 | build_runner_core: 75 | dependency: transitive 76 | description: 77 | name: build_runner_core 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "4.3.0" 81 | built_collection: 82 | dependency: transitive 83 | description: 84 | name: built_collection 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "4.3.2" 88 | built_value: 89 | dependency: transitive 90 | description: 91 | name: built_value 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "7.0.4" 95 | characters: 96 | dependency: transitive 97 | description: 98 | name: characters 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "1.1.0-nullsafety.3" 102 | charcode: 103 | dependency: transitive 104 | description: 105 | name: charcode 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "1.2.0-nullsafety.1" 109 | checked_yaml: 110 | dependency: transitive 111 | description: 112 | name: checked_yaml 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "1.0.2" 116 | clock: 117 | dependency: transitive 118 | description: 119 | name: clock 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "1.1.0-nullsafety.1" 123 | code_builder: 124 | dependency: transitive 125 | description: 126 | name: code_builder 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "3.2.1" 130 | collection: 131 | dependency: transitive 132 | description: 133 | name: collection 134 | url: "https://pub.dartlang.org" 135 | source: hosted 136 | version: "1.15.0-nullsafety.3" 137 | convert: 138 | dependency: transitive 139 | description: 140 | name: convert 141 | url: "https://pub.dartlang.org" 142 | source: hosted 143 | version: "2.1.1" 144 | crypto: 145 | dependency: transitive 146 | description: 147 | name: crypto 148 | url: "https://pub.dartlang.org" 149 | source: hosted 150 | version: "2.1.3" 151 | csslib: 152 | dependency: transitive 153 | description: 154 | name: csslib 155 | url: "https://pub.dartlang.org" 156 | source: hosted 157 | version: "0.16.1" 158 | cupertino_icons: 159 | dependency: "direct main" 160 | description: 161 | name: cupertino_icons 162 | url: "https://pub.dartlang.org" 163 | source: hosted 164 | version: "0.1.3" 165 | dart_style: 166 | dependency: transitive 167 | description: 168 | name: dart_style 169 | url: "https://pub.dartlang.org" 170 | source: hosted 171 | version: "1.3.3" 172 | dataclass: 173 | dependency: "direct main" 174 | description: 175 | name: dataclass 176 | url: "https://pub.dartlang.org" 177 | source: hosted 178 | version: "0.2.0" 179 | dataclass_generator: 180 | dependency: "direct dev" 181 | description: 182 | name: dataclass_generator 183 | url: "https://pub.dartlang.org" 184 | source: hosted 185 | version: "0.2.2" 186 | fake_async: 187 | dependency: transitive 188 | description: 189 | name: fake_async 190 | url: "https://pub.dartlang.org" 191 | source: hosted 192 | version: "1.2.0-nullsafety.1" 193 | fixnum: 194 | dependency: transitive 195 | description: 196 | name: fixnum 197 | url: "https://pub.dartlang.org" 198 | source: hosted 199 | version: "0.10.11" 200 | flutter: 201 | dependency: "direct main" 202 | description: flutter 203 | source: sdk 204 | version: "0.0.0" 205 | flutter_test: 206 | dependency: "direct dev" 207 | description: flutter 208 | source: sdk 209 | version: "0.0.0" 210 | glob: 211 | dependency: transitive 212 | description: 213 | name: glob 214 | url: "https://pub.dartlang.org" 215 | source: hosted 216 | version: "1.2.0" 217 | graphs: 218 | dependency: transitive 219 | description: 220 | name: graphs 221 | url: "https://pub.dartlang.org" 222 | source: hosted 223 | version: "0.2.0" 224 | html: 225 | dependency: transitive 226 | description: 227 | name: html 228 | url: "https://pub.dartlang.org" 229 | source: hosted 230 | version: "0.14.0+3" 231 | http: 232 | dependency: transitive 233 | description: 234 | name: http 235 | url: "https://pub.dartlang.org" 236 | source: hosted 237 | version: "0.12.0+4" 238 | http_multi_server: 239 | dependency: transitive 240 | description: 241 | name: http_multi_server 242 | url: "https://pub.dartlang.org" 243 | source: hosted 244 | version: "2.1.0" 245 | http_parser: 246 | dependency: transitive 247 | description: 248 | name: http_parser 249 | url: "https://pub.dartlang.org" 250 | source: hosted 251 | version: "3.1.3" 252 | io: 253 | dependency: transitive 254 | description: 255 | name: io 256 | url: "https://pub.dartlang.org" 257 | source: hosted 258 | version: "0.3.3" 259 | js: 260 | dependency: transitive 261 | description: 262 | name: js 263 | url: "https://pub.dartlang.org" 264 | source: hosted 265 | version: "0.6.1+1" 266 | json_annotation: 267 | dependency: transitive 268 | description: 269 | name: json_annotation 270 | url: "https://pub.dartlang.org" 271 | source: hosted 272 | version: "3.0.1" 273 | logging: 274 | dependency: transitive 275 | description: 276 | name: logging 277 | url: "https://pub.dartlang.org" 278 | source: hosted 279 | version: "0.11.3+2" 280 | matcher: 281 | dependency: transitive 282 | description: 283 | name: matcher 284 | url: "https://pub.dartlang.org" 285 | source: hosted 286 | version: "0.12.10-nullsafety.1" 287 | meta: 288 | dependency: transitive 289 | description: 290 | name: meta 291 | url: "https://pub.dartlang.org" 292 | source: hosted 293 | version: "1.3.0-nullsafety.4" 294 | mime: 295 | dependency: transitive 296 | description: 297 | name: mime 298 | url: "https://pub.dartlang.org" 299 | source: hosted 300 | version: "0.9.6+3" 301 | node_interop: 302 | dependency: transitive 303 | description: 304 | name: node_interop 305 | url: "https://pub.dartlang.org" 306 | source: hosted 307 | version: "1.0.3" 308 | node_io: 309 | dependency: transitive 310 | description: 311 | name: node_io 312 | url: "https://pub.dartlang.org" 313 | source: hosted 314 | version: "1.0.1+2" 315 | package_config: 316 | dependency: transitive 317 | description: 318 | name: package_config 319 | url: "https://pub.dartlang.org" 320 | source: hosted 321 | version: "1.1.0" 322 | package_resolver: 323 | dependency: transitive 324 | description: 325 | name: package_resolver 326 | url: "https://pub.dartlang.org" 327 | source: hosted 328 | version: "1.0.10" 329 | path: 330 | dependency: transitive 331 | description: 332 | name: path 333 | url: "https://pub.dartlang.org" 334 | source: hosted 335 | version: "1.8.0-nullsafety.1" 336 | pedantic: 337 | dependency: transitive 338 | description: 339 | name: pedantic 340 | url: "https://pub.dartlang.org" 341 | source: hosted 342 | version: "1.8.0+1" 343 | pool: 344 | dependency: transitive 345 | description: 346 | name: pool 347 | url: "https://pub.dartlang.org" 348 | source: hosted 349 | version: "1.4.0" 350 | pub_semver: 351 | dependency: transitive 352 | description: 353 | name: pub_semver 354 | url: "https://pub.dartlang.org" 355 | source: hosted 356 | version: "1.4.2" 357 | pubspec_parse: 358 | dependency: transitive 359 | description: 360 | name: pubspec_parse 361 | url: "https://pub.dartlang.org" 362 | source: hosted 363 | version: "0.1.5" 364 | quiver: 365 | dependency: transitive 366 | description: 367 | name: quiver 368 | url: "https://pub.dartlang.org" 369 | source: hosted 370 | version: "2.0.5" 371 | shelf: 372 | dependency: transitive 373 | description: 374 | name: shelf 375 | url: "https://pub.dartlang.org" 376 | source: hosted 377 | version: "0.7.5" 378 | shelf_web_socket: 379 | dependency: transitive 380 | description: 381 | name: shelf_web_socket 382 | url: "https://pub.dartlang.org" 383 | source: hosted 384 | version: "0.2.3" 385 | sky_engine: 386 | dependency: transitive 387 | description: flutter 388 | source: sdk 389 | version: "0.0.99" 390 | source_gen: 391 | dependency: transitive 392 | description: 393 | name: source_gen 394 | url: "https://pub.dartlang.org" 395 | source: hosted 396 | version: "0.9.4+7" 397 | source_span: 398 | dependency: transitive 399 | description: 400 | name: source_span 401 | url: "https://pub.dartlang.org" 402 | source: hosted 403 | version: "1.8.0-nullsafety.2" 404 | stack_trace: 405 | dependency: transitive 406 | description: 407 | name: stack_trace 408 | url: "https://pub.dartlang.org" 409 | source: hosted 410 | version: "1.10.0-nullsafety.4" 411 | stream_channel: 412 | dependency: transitive 413 | description: 414 | name: stream_channel 415 | url: "https://pub.dartlang.org" 416 | source: hosted 417 | version: "2.1.0-nullsafety.1" 418 | stream_transform: 419 | dependency: transitive 420 | description: 421 | name: stream_transform 422 | url: "https://pub.dartlang.org" 423 | source: hosted 424 | version: "1.1.0" 425 | string_scanner: 426 | dependency: transitive 427 | description: 428 | name: string_scanner 429 | url: "https://pub.dartlang.org" 430 | source: hosted 431 | version: "1.1.0-nullsafety.1" 432 | term_glyph: 433 | dependency: transitive 434 | description: 435 | name: term_glyph 436 | url: "https://pub.dartlang.org" 437 | source: hosted 438 | version: "1.2.0-nullsafety.1" 439 | test_api: 440 | dependency: transitive 441 | description: 442 | name: test_api 443 | url: "https://pub.dartlang.org" 444 | source: hosted 445 | version: "0.2.19-nullsafety.2" 446 | timing: 447 | dependency: transitive 448 | description: 449 | name: timing 450 | url: "https://pub.dartlang.org" 451 | source: hosted 452 | version: "0.1.1+2" 453 | typed_data: 454 | dependency: transitive 455 | description: 456 | name: typed_data 457 | url: "https://pub.dartlang.org" 458 | source: hosted 459 | version: "1.3.0-nullsafety.3" 460 | vector_math: 461 | dependency: transitive 462 | description: 463 | name: vector_math 464 | url: "https://pub.dartlang.org" 465 | source: hosted 466 | version: "2.1.0-nullsafety.3" 467 | watcher: 468 | dependency: transitive 469 | description: 470 | name: watcher 471 | url: "https://pub.dartlang.org" 472 | source: hosted 473 | version: "0.9.7+13" 474 | web_socket_channel: 475 | dependency: transitive 476 | description: 477 | name: web_socket_channel 478 | url: "https://pub.dartlang.org" 479 | source: hosted 480 | version: "1.1.0" 481 | yaml: 482 | dependency: transitive 483 | description: 484 | name: yaml 485 | url: "https://pub.dartlang.org" 486 | source: hosted 487 | version: "2.2.0" 488 | sdks: 489 | dart: ">=2.10.0-110 <=2.11.0-234.0.dev" 490 | -------------------------------------------------------------------------------- /dataclass/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dataclass_example 2 | description: A new Flutter project. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+1 15 | 16 | environment: 17 | sdk: ">=2.7.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | dataclass: 23 | # path: .. 24 | # The following adds the Cupertino Icons font to your application. 25 | # Use with the CupertinoIcons class for iOS style icons. 26 | cupertino_icons: ^0.1.2 27 | 28 | dev_dependencies: 29 | flutter_test: 30 | sdk: flutter 31 | dataclass_generator: 32 | # path: ../../dataclass_generator/ 33 | build_runner: ^1.7.0 34 | 35 | # For information on the generic Dart part of this file, see the 36 | # following page: https://dart.dev/tools/pub/pubspec 37 | 38 | # The following section is specific to Flutter. 39 | flutter: 40 | # The following line ensures that the Material Icons font is 41 | # included with your application, so that you can use the icons in 42 | # the material Icons class. 43 | uses-material-design: true 44 | # To add assets to your application, add an assets section, like this: 45 | # assets: 46 | # - images/a_dot_burr.jpeg 47 | # - images/a_dot_ham.jpeg 48 | # An image asset can refer to one or more resolution-specific "variants", see 49 | # https://flutter.dev/assets-and-images/#resolution-aware. 50 | # For details regarding adding assets from package dependencies, see 51 | # https://flutter.dev/assets-and-images/#from-packages 52 | # To add custom fonts to your application, add a fonts section here, 53 | # in this "flutter" section. Each entry in this list should have a 54 | # "family" key with the font family name, and a "fonts" key with a 55 | # list giving the asset and other descriptors for the font. For 56 | # example: 57 | # fonts: 58 | # - family: Schyler 59 | # fonts: 60 | # - asset: fonts/Schyler-Regular.ttf 61 | # - asset: fonts/Schyler-Italic.ttf 62 | # style: italic 63 | # - family: Trajan Pro 64 | # fonts: 65 | # - asset: fonts/TrajanPro.ttf 66 | # - asset: fonts/TrajanPro_Bold.ttf 67 | # weight: 700 68 | # 69 | # For details regarding fonts from package dependencies, 70 | # see https://flutter.dev/custom-fonts/#from-packages 71 | -------------------------------------------------------------------------------- /dataclass/example/test/dataclass_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter_test/flutter_test.dart'; 9 | 10 | import 'package:dataclass_example/example.dart'; 11 | 12 | void main() { 13 | final car1 = Car(name: 'Corolla', manufacturer: 'Toyota', price: 500.0); 14 | final car2 = Car(name: 'Corolla', manufacturer: 'Toyota', price: 500.0); 15 | final car3 = Car(name: 'Avensis', manufacturer: 'Toyota', price: 500.0); 16 | 17 | group('equals', () { 18 | test('car1 == car2', () { 19 | expect(car1, car2); 20 | }); 21 | 22 | test('car2 != car3', () { 23 | expect(car2, isNot(car3)); 24 | }); 25 | }); 26 | 27 | group('hashCode', () { 28 | test('car1 hashCode == car2 hashCode', () { 29 | expect(car1.hashCode, car2.hashCode); 30 | }); 31 | 32 | test('car1 hashCode != car3 hashCode', () { 33 | expect(car1.hashCode, isNot(car3.hashCode)); 34 | }); 35 | }); 36 | 37 | group('copyWith', () { 38 | test('car1 copyWith is creating new instance', () { 39 | final copiedCar1 = car1.copyWith(); 40 | 41 | assert(!identical(car1, copiedCar1)); 42 | }); 43 | 44 | test('car3 with changed name to Corolla equals to car1', () { 45 | expect(car3.copyWith(name: 'Corolla'), car1); 46 | }); 47 | }); 48 | } 49 | -------------------------------------------------------------------------------- /dataclass/lib/dataclass.dart: -------------------------------------------------------------------------------- 1 | library dataclass; 2 | 3 | export 'package:collection/collection.dart'; 4 | 5 | /// Short-hand annotation for `@DataClass()`. 6 | /// You can use `@dataClass` instead of `@DataClass()` 7 | const dataClass = DataClass(); 8 | 9 | class DataClass { 10 | /// DataClass annotation used for dataclass code generation 11 | const DataClass(); 12 | } 13 | 14 | class Collection { 15 | final bool deepEquality; 16 | 17 | /// If `deepEquality` is set to true. 18 | /// The generated `operator==` uses DeepCollectionEquality from collection package 19 | const Collection({this.deepEquality = true}); 20 | } 21 | 22 | // Copied from equatable packages 23 | int mapPropsToHashCode(Iterable props) => 24 | _finish(props.fold(0, (hash, object) => _combine(hash, object))); 25 | 26 | /// Jenkins Hash Functions 27 | /// https://en.wikipedia.org/wiki/Jenkins_hash_function 28 | int _combine(int hash, dynamic object) { 29 | if (object is Map) { 30 | object.forEach((key, value) { 31 | hash = hash ^ _combine(hash, [key, value]); 32 | }); 33 | return hash; 34 | } 35 | if (object is Iterable) return mapPropsToHashCode(object); 36 | hash = 0x1fffffff & (hash + object.hashCode); 37 | hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); 38 | return hash ^ (hash >> 6); 39 | } 40 | 41 | int _finish(int hash) { 42 | hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); 43 | hash = hash ^ (hash >> 11); 44 | return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); 45 | } 46 | -------------------------------------------------------------------------------- /dataclass/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | collection: 5 | dependency: "direct main" 6 | description: 7 | name: collection 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "1.14.13" 11 | sdks: 12 | dart: ">=2.3.0 <3.0.0" 13 | -------------------------------------------------------------------------------- /dataclass/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dataclass 2 | description: DataClass annotation for dataclass_generator. Used for generating base class with equals, hashCode, toString, copyWith methods. 3 | version: 0.5.0+1 4 | author: Jaroslaw Butajlo 5 | homepage: https://github.com/jarekb123/dart_dataclass 6 | 7 | environment: 8 | sdk: ">=2.0.0 <3.0.0" 9 | 10 | dependencies: 11 | collection: ">=1.14.0 <1.16.0" 12 | 13 | dev_dependencies: 14 | -------------------------------------------------------------------------------- /dataclass_generator/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | build/ 31 | 32 | # Android related 33 | **/android/**/gradle-wrapper.jar 34 | **/android/.gradle 35 | **/android/captures/ 36 | **/android/gradlew 37 | **/android/gradlew.bat 38 | **/android/local.properties 39 | **/android/**/GeneratedPluginRegistrant.java 40 | 41 | # iOS/XCode related 42 | **/ios/**/*.mode1v3 43 | **/ios/**/*.mode2v3 44 | **/ios/**/*.moved-aside 45 | **/ios/**/*.pbxuser 46 | **/ios/**/*.perspectivev3 47 | **/ios/**/*sync/ 48 | **/ios/**/.sconsign.dblite 49 | **/ios/**/.tags* 50 | **/ios/**/.vagrant/ 51 | **/ios/**/DerivedData/ 52 | **/ios/**/Icon? 53 | **/ios/**/Pods/ 54 | **/ios/**/.symlinks/ 55 | **/ios/**/profile 56 | **/ios/**/xcuserdata 57 | **/ios/.generated/ 58 | **/ios/Flutter/App.framework 59 | **/ios/Flutter/Flutter.framework 60 | **/ios/Flutter/Generated.xcconfig 61 | **/ios/Flutter/app.flx 62 | **/ios/Flutter/app.zip 63 | **/ios/Flutter/flutter_assets/ 64 | **/ios/Flutter/flutter_export_environment.sh 65 | **/ios/ServiceDefinitions.json 66 | **/ios/Runner/GeneratedPluginRegistrant.* 67 | 68 | # Exceptions to above rules. 69 | !**/ios/**/default.mode1v3 70 | !**/ios/**/default.mode2v3 71 | !**/ios/**/default.pbxuser 72 | !**/ios/**/default.perspectivev3 73 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 74 | -------------------------------------------------------------------------------- /dataclass_generator/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 68587a0916366e9512a78df22c44163d041dd5f3 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /dataclass_generator/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.5.0] 2 | * Update dependencies 3 | 4 | ## [0.4.0] 5 | * Do not getter-only fields in generating data class methods - thanks to [@mrbech](https://github.com/mrbech) 6 | 7 | ## [0.3.0+2] 8 | * Remove debug prints 9 | 10 | ## [0.3.0+1] 11 | * Copy README from repository to `dataclass_generator` directory 12 | 13 | ## [0.3.0] - 2019/01/19 14 | * Add @Collection() annotation to use DeepCollectionEquality from `collection` package to compare collections 15 | * Add `@dataClass` shorthand for `@DataClass()` 16 | 17 | ## [0.2.2] - 2019/12/31 18 | * **FIX** not generating full declaration of collection. eg. `List get field` instead `List get field` 19 | 20 | ## [0.2.1] - 2019/12/26 21 | * **FIX** not generating base classes for @DataClass classes with no fields 22 | 23 | ## [0.2.0] - 2019/12/25 24 | * enable usage of generic types, eg. `Product` 25 | * **BREAKING CHANGE**: change generated class name from `_Class` to `_$Class` 26 | 27 | ## [0.1.0+2] - 2019/12/22 28 | * update README - repo badges 29 | 30 | ## [0.1.0+1] - 2019/12/22 31 | * add README 32 | 33 | ## [0.1.0] - 2019/12/22 34 | * generating base class with equals, hashCode, toString, copyWith methods. 35 | -------------------------------------------------------------------------------- /dataclass_generator/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Jaroslaw Butajlo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /dataclass_generator/README.md: -------------------------------------------------------------------------------- 1 | # Generator for dataclass package 2 | 3 | [![License](https://img.shields.io/github/license/jarekb123/dart_dataclass?style=flat-square&logo=github)](https://github.com/jarekb123/dart_dataclass/blob/master/LICENSE) [![Pub.dev](https://img.shields.io/pub/v/dataclass_generator.svg?style=flat-square&logo=data:image/png;base64,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)](https://pub.dartlang.org/packages/dataclass_generator) [![Github Stars](https://img.shields.io/github/stars/jarekb123/dart_dataclass?style=flat-square&logo=github)](https://github.com/jarekb123/dart_dataclass) 4 | 5 | `@DataClass` source generator used by `dataclass` package 6 | 7 | The DataClass generator generates base class for your data class with methods: 8 | 9 | - equals (operator ==) 10 | - hashCode 11 | - toString 12 | - copyWith 13 | 14 | ## Getting Started 15 | 16 | ### 1. Annotate your class with @dataClass 17 | 18 | The class should: 19 | 20 | - has only final fields 21 | - unnamed constructor with named parameters for all fields 22 | 23 | ```dart 24 | @dataClass 25 | class Car { 26 | final String name; 27 | final String manufacturer; 28 | final double price; 29 | 30 | Car({this.name, this.manufacturer, this.price}); 31 | } 32 | ``` 33 | 34 | ### 2. Generate dataclass base class 35 | 36 | Run `pub run build_runner build` 37 | 38 | #### Generated file 39 | 40 | ```dart 41 | abstract class _$Car { 42 | const _$Car(); 43 | 44 | String get name; 45 | String get manufacturer; 46 | double get price; 47 | bool operator ==(other) { 48 | if (identical(this, other)) return true; 49 | if (other is! Car) return false; 50 | 51 | return true && 52 | this.name == other.name && 53 | this.manufacturer == other.manufacturer && 54 | this.price == other.price; 55 | } 56 | 57 | int get hashCode { 58 | return mapPropsToHashCode([name, manufacturer, price]); 59 | } 60 | 61 | String toString() { 62 | return 'Car <\'name\': ${this.name},\'manufacturer\': ${this.manufacturer},\'price\': ${this.price},>'; 63 | } 64 | 65 | Car copyWith({String name, String manufacturer, double price}) { 66 | return Car( 67 | name: name ?? this.name, 68 | manufacturer: manufacturer ?? this.manufacturer, 69 | price: price ?? this.price, 70 | ); 71 | } 72 | } 73 | ``` 74 | 75 | ### 3. Extend class with generated base class 76 | 77 | ```dart 78 | @dataClass 79 | class Car extends _$Car { 80 | final String name; 81 | final String manufacturer; 82 | final double price; 83 | 84 | Car({this.name, this.manufacturer, this.price}); 85 | } 86 | ``` 87 | 88 | #### Collection equality 89 | ```dart 90 | 91 | @dataClass 92 | class Car extends _$Car { 93 | @Collection(deepEquality: true) // Short-hand: @Collection() 94 | final List parts; 95 | 96 | const Car({this.parts}); 97 | } 98 | ``` 99 | 100 | ## FAQ 101 | 102 | 1. Why you didn't use extension methods? 103 | 104 | As the docs says that: 105 | 106 | It is a compile-time error if an extension: 107 | 108 | - Declares a member with the same basename as a member declared by Object (==, hashCode, toString, noSuchMethod, runtimeType). This applies to both static and instance member declarations. 109 | 110 | 111 | 2. May I use generics? 112 | 113 | Yes. -------------------------------------------------------------------------------- /dataclass_generator/build.yaml: -------------------------------------------------------------------------------- 1 | targets: 2 | $default: 3 | builders: 4 | dataclass_generator|dataclass: 5 | enabled: true 6 | 7 | builders: 8 | dataclass: 9 | target: ":dataclass_generator" 10 | import: "package:dataclass_generator/dataclass_generator.dart" 11 | builder_factories: ["dataClass"] 12 | build_extensions: {".dart": [".g.part"]} 13 | auto_apply: dependents 14 | build_to: cache 15 | applies_builders: ["source_gen|combining_builder"] -------------------------------------------------------------------------------- /dataclass_generator/lib/dataclass_generator.dart: -------------------------------------------------------------------------------- 1 | library dataclass_generator; 2 | 3 | import 'dart:async'; 4 | 5 | import 'package:analyzer/dart/element/element.dart'; 6 | import 'package:build/build.dart'; 7 | import 'package:code_builder/code_builder.dart'; 8 | import 'package:dart_style/dart_style.dart'; 9 | import 'package:dataclass/dataclass.dart'; 10 | import 'package:source_gen/source_gen.dart'; 11 | 12 | Builder dataClass(BuilderOptions options) => 13 | SharedPartBuilder([DataClassGenerator()], 'dataclass'); 14 | 15 | class DataClassGenerator extends GeneratorForAnnotation { 16 | final emitter = DartEmitter(); 17 | final formatter = DartFormatter(); 18 | 19 | @override 20 | FutureOr generateForAnnotatedElement( 21 | Element element, 22 | ConstantReader annotation, 23 | BuildStep buildStep, 24 | ) { 25 | void _isSourceValid(ClassElement element) { 26 | if (element.unnamedConstructor == null) { 27 | throw InvalidGenerationSourceError( 28 | 'The ${element.name} @DataClass must have unnamed (default) constructor'); 29 | } 30 | if (element.unnamedConstructor.parameters.isNotEmpty) { 31 | if (!element.unnamedConstructor.parameters 32 | .any((param) => param.isNamed)) { 33 | throw InvalidGenerationSourceError( 34 | 'The ${element.name} @DataClass constructor should have named params only'); 35 | } 36 | } 37 | 38 | if (element.fields.any((field) => !field.isFinal)) { 39 | throw InvalidGenerationSourceError( 40 | '@DataClass should have final fields only'); 41 | } 42 | } 43 | 44 | if (element is ClassElement && !element.isAbstract) { 45 | _isSourceValid(element); 46 | 47 | final fields = element.fields.where((f) => !isGetter(f)).toList(); 48 | 49 | final equalsMethod = _equalsMethod(element.displayName, fields); 50 | final copyWithMethod = _copyWithMethod(element, fields); 51 | final hashCodeMethod = _hashCodeMethod(fields); 52 | final toStringMethod = _toStringMethod(element.displayName, fields); 53 | 54 | final getters = fields 55 | .map((field) => MethodBuilder() 56 | ..name = field.displayName 57 | ..returns = refer(field.type.getDisplayString(withNullability: false)) 58 | ..type = MethodType.getter) 59 | .map((mb) => mb.build()); 60 | 61 | final constConstructor = (ConstructorBuilder()..constant = true).build(); 62 | 63 | final dataClass = ClassBuilder() 64 | ..name = '_\$${element.name}' 65 | ..constructors.add(constConstructor) 66 | ..types.addAll(element.typeParameters 67 | .map((typeParam) => refer(typeParam.displayName))) 68 | ..methods.addAll(getters) 69 | ..methods.add(equalsMethod) 70 | ..methods.add(hashCodeMethod) 71 | ..methods.add(toStringMethod) 72 | ..methods.add(copyWithMethod) 73 | ..abstract = true; 74 | 75 | return formatter.format(dataClass.build().accept(emitter).toString()); 76 | } else { 77 | throw Exception( 78 | '@DataClass anontation cannot be used on abstract classes', 79 | ); 80 | } 81 | } 82 | 83 | Method _equalsMethod(String className, List fields) { 84 | MethodBuilder mb = MethodBuilder() 85 | ..name = 'operator==' 86 | ..requiredParameters.add((ParameterBuilder()..name = 'other').build()) 87 | ..returns = refer('bool') 88 | ..body = Code( 89 | equalsBody( 90 | className, 91 | Map.fromIterable(fields, 92 | key: (element) => element.displayName, 93 | value: (element) => _hasDeepCollectionEquality(element)), 94 | ), 95 | ); 96 | 97 | fields.map( 98 | (element) => element.metadata.map( 99 | (annotation) => annotation 100 | .computeConstantValue() 101 | .getField('deepEquality') 102 | .toBoolValue(), 103 | ), 104 | ); 105 | 106 | return mb.build(); 107 | } 108 | 109 | bool _hasDeepCollectionEquality(FieldElement fieldElement) { 110 | final collectionAnnotation = 111 | TypeChecker.fromRuntime(Collection).firstAnnotationOf(fieldElement); 112 | 113 | if (collectionAnnotation == null) 114 | return false; 115 | else { 116 | return collectionAnnotation.getField('deepEquality').toBoolValue(); 117 | } 118 | } 119 | 120 | Method _hashCodeMethod(List fields) { 121 | final props = fields.map((field) => field.name); 122 | 123 | MethodBuilder mb = MethodBuilder() 124 | ..name = 'hashCode' 125 | ..type = MethodType.getter 126 | ..returns = refer('int') 127 | ..body = Code( 128 | ''' 129 | return mapPropsToHashCode([${props.join(', ')}]); 130 | ''', 131 | ); 132 | 133 | return mb.build(); 134 | } 135 | 136 | Method _copyWithMethod(ClassElement clazz, List fields) { 137 | final params = fields 138 | .map((field) => ParameterBuilder() 139 | ..name = field.name 140 | ..type = refer(field.type.getDisplayString(withNullability: false)) 141 | ..named = true) 142 | .map((paramBuilder) => paramBuilder.build()); 143 | 144 | final mb = MethodBuilder() 145 | ..name = 'copyWith' 146 | ..optionalParameters.addAll(params) 147 | ..returns = refer(clazz.name) 148 | ..body = Code( 149 | copyToMethodBody(clazz, fields.map((field) => field.displayName))); 150 | 151 | return mb.build(); 152 | } 153 | 154 | Method _toStringMethod(String className, List fields) { 155 | final mb = MethodBuilder() 156 | ..name = 'toString' 157 | ..returns = refer('String') 158 | ..body = Code( 159 | toStringBody(className, fields.map((field) => field.displayName))); 160 | 161 | return mb.build(); 162 | } 163 | } 164 | 165 | String equalsBody(String className, Map fields) { 166 | final fieldEquals = fields.entries.fold('true', (value, element) { 167 | final hasDeepCollectionEquality = element.value; 168 | if (hasDeepCollectionEquality) { 169 | return '$value && DeepCollectionEquality().equals(this.${element.key},other.${element.key})'; 170 | } else { 171 | return '$value && this.${element.key} == other.${element.key}'; 172 | } 173 | }); 174 | 175 | return ''' 176 | if (identical(this, other)) return true; 177 | if (other is! $className) return false; 178 | 179 | return $fieldEquals; 180 | '''; 181 | } 182 | 183 | String copyToMethodBody(ClassElement clazz, Iterable fields) { 184 | final paramsInput = fields.fold( 185 | "", 186 | (r, field) => "$r ${field}: ${field} ?? this.${field},", 187 | ); 188 | 189 | final typeParameters = clazz.typeParameters.isEmpty 190 | ? '' 191 | : '<' + clazz.typeParameters.map((type) => type.name).join(',') + '>'; 192 | 193 | return '''return ${clazz.name}$typeParameters($paramsInput);'''; 194 | } 195 | 196 | String toStringBody(String className, Iterable fields) { 197 | final fieldsToString = 198 | fields.fold('', (r, field) => r + '\\\'$field\\\': \${this.$field},'); 199 | 200 | return "return '$className <$fieldsToString>';"; 201 | } 202 | 203 | bool isGetter(FieldElement f) { 204 | return f.getter != null && !f.getter.isSynthetic; 205 | } 206 | -------------------------------------------------------------------------------- /dataclass_generator/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _fe_analyzer_shared: 5 | dependency: transitive 6 | description: 7 | name: _fe_analyzer_shared 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "11.0.0" 11 | analyzer: 12 | dependency: "direct main" 13 | description: 14 | name: analyzer 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "0.40.4" 18 | args: 19 | dependency: transitive 20 | description: 21 | name: args 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.5.2" 25 | async: 26 | dependency: transitive 27 | description: 28 | name: async 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.4.0" 32 | boolean_selector: 33 | dependency: transitive 34 | description: 35 | name: boolean_selector 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.0.5" 39 | build: 40 | dependency: "direct main" 41 | description: 42 | name: build 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.5.0" 46 | build_config: 47 | dependency: transitive 48 | description: 49 | name: build_config 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "0.4.2" 53 | build_daemon: 54 | dependency: transitive 55 | description: 56 | name: build_daemon 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.0" 60 | build_resolvers: 61 | dependency: transitive 62 | description: 63 | name: build_resolvers 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.4.1" 67 | build_runner: 68 | dependency: "direct dev" 69 | description: 70 | name: build_runner 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.10.3" 74 | build_runner_core: 75 | dependency: transitive 76 | description: 77 | name: build_runner_core 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "6.0.3" 81 | build_test: 82 | dependency: "direct dev" 83 | description: 84 | name: build_test 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "1.2.2" 88 | built_collection: 89 | dependency: transitive 90 | description: 91 | name: built_collection 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "4.2.2" 95 | built_value: 96 | dependency: transitive 97 | description: 98 | name: built_value 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "6.7.1" 102 | charcode: 103 | dependency: transitive 104 | description: 105 | name: charcode 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "1.1.2" 109 | checked_yaml: 110 | dependency: transitive 111 | description: 112 | name: checked_yaml 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "1.0.2" 116 | cli_util: 117 | dependency: transitive 118 | description: 119 | name: cli_util 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "0.2.0" 123 | code_builder: 124 | dependency: "direct main" 125 | description: 126 | name: code_builder 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "3.2.0" 130 | collection: 131 | dependency: transitive 132 | description: 133 | name: collection 134 | url: "https://pub.dartlang.org" 135 | source: hosted 136 | version: "1.14.12" 137 | convert: 138 | dependency: transitive 139 | description: 140 | name: convert 141 | url: "https://pub.dartlang.org" 142 | source: hosted 143 | version: "2.1.1" 144 | coverage: 145 | dependency: transitive 146 | description: 147 | name: coverage 148 | url: "https://pub.dartlang.org" 149 | source: hosted 150 | version: "0.14.1" 151 | crypto: 152 | dependency: transitive 153 | description: 154 | name: crypto 155 | url: "https://pub.dartlang.org" 156 | source: hosted 157 | version: "2.1.4" 158 | csslib: 159 | dependency: transitive 160 | description: 161 | name: csslib 162 | url: "https://pub.dartlang.org" 163 | source: hosted 164 | version: "0.16.1" 165 | dart_style: 166 | dependency: "direct main" 167 | description: 168 | name: dart_style 169 | url: "https://pub.dartlang.org" 170 | source: hosted 171 | version: "1.3.7" 172 | dataclass: 173 | dependency: "direct main" 174 | description: 175 | name: dataclass 176 | url: "https://pub.dartlang.org" 177 | source: hosted 178 | version: "0.5.0" 179 | fixnum: 180 | dependency: transitive 181 | description: 182 | name: fixnum 183 | url: "https://pub.dartlang.org" 184 | source: hosted 185 | version: "0.10.11" 186 | glob: 187 | dependency: transitive 188 | description: 189 | name: glob 190 | url: "https://pub.dartlang.org" 191 | source: hosted 192 | version: "1.2.0" 193 | graphs: 194 | dependency: transitive 195 | description: 196 | name: graphs 197 | url: "https://pub.dartlang.org" 198 | source: hosted 199 | version: "0.2.0" 200 | html: 201 | dependency: transitive 202 | description: 203 | name: html 204 | url: "https://pub.dartlang.org" 205 | source: hosted 206 | version: "0.14.0+3" 207 | http: 208 | dependency: transitive 209 | description: 210 | name: http 211 | url: "https://pub.dartlang.org" 212 | source: hosted 213 | version: "0.12.0+2" 214 | http_multi_server: 215 | dependency: transitive 216 | description: 217 | name: http_multi_server 218 | url: "https://pub.dartlang.org" 219 | source: hosted 220 | version: "2.1.0" 221 | http_parser: 222 | dependency: transitive 223 | description: 224 | name: http_parser 225 | url: "https://pub.dartlang.org" 226 | source: hosted 227 | version: "3.1.3" 228 | io: 229 | dependency: transitive 230 | description: 231 | name: io 232 | url: "https://pub.dartlang.org" 233 | source: hosted 234 | version: "0.3.3" 235 | js: 236 | dependency: transitive 237 | description: 238 | name: js 239 | url: "https://pub.dartlang.org" 240 | source: hosted 241 | version: "0.6.1+1" 242 | json_annotation: 243 | dependency: transitive 244 | description: 245 | name: json_annotation 246 | url: "https://pub.dartlang.org" 247 | source: hosted 248 | version: "3.0.0" 249 | logging: 250 | dependency: transitive 251 | description: 252 | name: logging 253 | url: "https://pub.dartlang.org" 254 | source: hosted 255 | version: "0.11.3+2" 256 | matcher: 257 | dependency: transitive 258 | description: 259 | name: matcher 260 | url: "https://pub.dartlang.org" 261 | source: hosted 262 | version: "0.12.9" 263 | meta: 264 | dependency: transitive 265 | description: 266 | name: meta 267 | url: "https://pub.dartlang.org" 268 | source: hosted 269 | version: "1.2.3" 270 | mime: 271 | dependency: transitive 272 | description: 273 | name: mime 274 | url: "https://pub.dartlang.org" 275 | source: hosted 276 | version: "0.9.6+3" 277 | node_interop: 278 | dependency: transitive 279 | description: 280 | name: node_interop 281 | url: "https://pub.dartlang.org" 282 | source: hosted 283 | version: "1.0.3" 284 | node_io: 285 | dependency: transitive 286 | description: 287 | name: node_io 288 | url: "https://pub.dartlang.org" 289 | source: hosted 290 | version: "1.0.1+2" 291 | node_preamble: 292 | dependency: transitive 293 | description: 294 | name: node_preamble 295 | url: "https://pub.dartlang.org" 296 | source: hosted 297 | version: "1.4.8" 298 | package_config: 299 | dependency: transitive 300 | description: 301 | name: package_config 302 | url: "https://pub.dartlang.org" 303 | source: hosted 304 | version: "1.9.3" 305 | package_resolver: 306 | dependency: transitive 307 | description: 308 | name: package_resolver 309 | url: "https://pub.dartlang.org" 310 | source: hosted 311 | version: "1.0.10" 312 | path: 313 | dependency: transitive 314 | description: 315 | name: path 316 | url: "https://pub.dartlang.org" 317 | source: hosted 318 | version: "1.6.4" 319 | pedantic: 320 | dependency: transitive 321 | description: 322 | name: pedantic 323 | url: "https://pub.dartlang.org" 324 | source: hosted 325 | version: "1.9.0" 326 | pool: 327 | dependency: transitive 328 | description: 329 | name: pool 330 | url: "https://pub.dartlang.org" 331 | source: hosted 332 | version: "1.4.0" 333 | pub_semver: 334 | dependency: transitive 335 | description: 336 | name: pub_semver 337 | url: "https://pub.dartlang.org" 338 | source: hosted 339 | version: "1.4.2" 340 | pubspec_parse: 341 | dependency: transitive 342 | description: 343 | name: pubspec_parse 344 | url: "https://pub.dartlang.org" 345 | source: hosted 346 | version: "0.1.5" 347 | quiver: 348 | dependency: transitive 349 | description: 350 | name: quiver 351 | url: "https://pub.dartlang.org" 352 | source: hosted 353 | version: "2.1.2+1" 354 | shelf: 355 | dependency: transitive 356 | description: 357 | name: shelf 358 | url: "https://pub.dartlang.org" 359 | source: hosted 360 | version: "0.7.5" 361 | shelf_packages_handler: 362 | dependency: transitive 363 | description: 364 | name: shelf_packages_handler 365 | url: "https://pub.dartlang.org" 366 | source: hosted 367 | version: "1.0.4" 368 | shelf_static: 369 | dependency: transitive 370 | description: 371 | name: shelf_static 372 | url: "https://pub.dartlang.org" 373 | source: hosted 374 | version: "0.2.8" 375 | shelf_web_socket: 376 | dependency: transitive 377 | description: 378 | name: shelf_web_socket 379 | url: "https://pub.dartlang.org" 380 | source: hosted 381 | version: "0.2.3" 382 | source_gen: 383 | dependency: "direct main" 384 | description: 385 | name: source_gen 386 | url: "https://pub.dartlang.org" 387 | source: hosted 388 | version: "0.9.7+1" 389 | source_map_stack_trace: 390 | dependency: transitive 391 | description: 392 | name: source_map_stack_trace 393 | url: "https://pub.dartlang.org" 394 | source: hosted 395 | version: "2.0.0" 396 | source_maps: 397 | dependency: transitive 398 | description: 399 | name: source_maps 400 | url: "https://pub.dartlang.org" 401 | source: hosted 402 | version: "0.10.8" 403 | source_span: 404 | dependency: transitive 405 | description: 406 | name: source_span 407 | url: "https://pub.dartlang.org" 408 | source: hosted 409 | version: "1.5.5" 410 | stack_trace: 411 | dependency: transitive 412 | description: 413 | name: stack_trace 414 | url: "https://pub.dartlang.org" 415 | source: hosted 416 | version: "1.9.3" 417 | stream_channel: 418 | dependency: transitive 419 | description: 420 | name: stream_channel 421 | url: "https://pub.dartlang.org" 422 | source: hosted 423 | version: "2.0.0" 424 | stream_transform: 425 | dependency: transitive 426 | description: 427 | name: stream_transform 428 | url: "https://pub.dartlang.org" 429 | source: hosted 430 | version: "0.0.20" 431 | string_scanner: 432 | dependency: transitive 433 | description: 434 | name: string_scanner 435 | url: "https://pub.dartlang.org" 436 | source: hosted 437 | version: "1.0.5" 438 | term_glyph: 439 | dependency: transitive 440 | description: 441 | name: term_glyph 442 | url: "https://pub.dartlang.org" 443 | source: hosted 444 | version: "1.1.0" 445 | test: 446 | dependency: "direct dev" 447 | description: 448 | name: test 449 | url: "https://pub.dartlang.org" 450 | source: hosted 451 | version: "1.15.4" 452 | test_api: 453 | dependency: transitive 454 | description: 455 | name: test_api 456 | url: "https://pub.dartlang.org" 457 | source: hosted 458 | version: "0.2.18" 459 | test_core: 460 | dependency: transitive 461 | description: 462 | name: test_core 463 | url: "https://pub.dartlang.org" 464 | source: hosted 465 | version: "0.3.11+1" 466 | timing: 467 | dependency: transitive 468 | description: 469 | name: timing 470 | url: "https://pub.dartlang.org" 471 | source: hosted 472 | version: "0.1.1+2" 473 | typed_data: 474 | dependency: transitive 475 | description: 476 | name: typed_data 477 | url: "https://pub.dartlang.org" 478 | source: hosted 479 | version: "1.1.6" 480 | vm_service: 481 | dependency: transitive 482 | description: 483 | name: vm_service 484 | url: "https://pub.dartlang.org" 485 | source: hosted 486 | version: "2.1.3" 487 | watcher: 488 | dependency: transitive 489 | description: 490 | name: watcher 491 | url: "https://pub.dartlang.org" 492 | source: hosted 493 | version: "0.9.7+13" 494 | web_socket_channel: 495 | dependency: transitive 496 | description: 497 | name: web_socket_channel 498 | url: "https://pub.dartlang.org" 499 | source: hosted 500 | version: "1.1.0" 501 | webkit_inspection_protocol: 502 | dependency: transitive 503 | description: 504 | name: webkit_inspection_protocol 505 | url: "https://pub.dartlang.org" 506 | source: hosted 507 | version: "0.7.3" 508 | yaml: 509 | dependency: transitive 510 | description: 511 | name: yaml 512 | url: "https://pub.dartlang.org" 513 | source: hosted 514 | version: "2.2.0" 515 | sdks: 516 | dart: ">=2.10.0-93.0.dev <3.0.0" 517 | -------------------------------------------------------------------------------- /dataclass_generator/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dataclass_generator 2 | description: DataClass annotation for dataclass_generator. Used for generating base class with equals, hashCode, toString, copyWith methods. 3 | version: 0.5.0+2 4 | author: Jaroslaw Butajlo 5 | homepage: https://github.com/jarekb123/dart_dataclass 6 | 7 | environment: 8 | sdk: ">=2.9.0 <3.0.0" 9 | 10 | dependencies: 11 | dataclass: ">=0.5.0 <0.6.0" 12 | # dataclass: 13 | # path: ../dataclass/ 14 | build: ">=1.5.0 <1.6.0" 15 | source_gen: ">=0.9.0 <0.10.0" 16 | code_builder: ">=3.2.0 <3.3.0" 17 | dart_style: ">=1.3.0 <1.4.0" 18 | analyzer: ">=0.40.0 <0.41.0" 19 | 20 | dev_dependencies: 21 | build_test: 22 | build_runner: ">=1.10.3 <1.11.0" 23 | test: 24 | --------------------------------------------------------------------------------