├── android ├── gradle.properties ├── app │ ├── src │ │ └── main │ │ │ ├── res │ │ │ ├── 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 │ │ │ └── drawable │ │ │ │ └── launch_background.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── orm │ │ │ │ └── flutterormdemo │ │ │ │ └── MainActivity.java │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle └── build.gradle ├── img ├── main.jpg └── select.jpg ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── AppDelegate.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── 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-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── main.m │ ├── AppDelegate.m │ ├── Info.plist │ └── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ └── project.pbxproj ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── WorkspaceSettings.xcsettings └── Podfile ├── .metadata ├── test └── widget_test.dart ├── .gitignore ├── lib ├── SelectAllDemo.dart ├── WhereSortDemo.dart ├── SelectFirstDemo.dart ├── SelectByPrimaryKeyDemo.dart ├── WhereSqlDemo.dart ├── SelectPortionColumnsDemo.dart ├── WhereCondictionDemo.dart ├── SelectGroupbyHavingDemo.dart ├── WhereMutiCondictionDemo.dart ├── SelectWhereDemo.dart ├── DeleteDemo.dart ├── UpdateAllDemo.dart ├── UpdateSqlDemo.dart ├── UpdateByPrimaryKeyDemo.dart ├── UpdateByCondictionsDemo.dart ├── JoinDemo.dart ├── UpdateDemo.dart ├── DeleteAllDemo.dart ├── SelectDemo.dart ├── DeleteSqlDemo.dart ├── DeleteByPrimaryKeyDemo.dart ├── DeleteByCondictionsDemo.dart ├── InsertDemo.dart ├── main.dart ├── ForeignKeyJoinDemo.dart ├── JoinOrderByDemo.dart ├── JoinByGroupDemo.dart ├── InnerJoinDemo.dart ├── LeftJoinDemo.dart ├── JoinPortionColumnsDemo.dart └── JoinByWhereDemo.dart ├── pubspec.yaml └── README.md /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /img/main.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/img/main.jpg -------------------------------------------------------------------------------- /img/select.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/img/select.jpg -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Original 7 | 8 | 9 | -------------------------------------------------------------------------------- /.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: 5391447fae6209bb21a89e6a5a6583cac1af9b4b 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/orm/flutterormdemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.orm.flutterormdemo; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.2.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:flutter_orm_demo/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # Visual Studio Code related 20 | .vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | .dart_tool/ 25 | .flutter-plugins 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | # Android related 32 | **/android/**/gradle-wrapper.jar 33 | **/android/.gradle 34 | **/android/captures/ 35 | **/android/gradlew 36 | **/android/gradlew.bat 37 | **/android/local.properties 38 | **/android/**/GeneratedPluginRegistrant.java 39 | 40 | # iOS/XCode related 41 | **/ios/**/*.mode1v3 42 | **/ios/**/*.mode2v3 43 | **/ios/**/*.moved-aside 44 | **/ios/**/*.pbxuser 45 | **/ios/**/*.perspectivev3 46 | **/ios/**/*sync/ 47 | **/ios/**/.sconsign.dblite 48 | **/ios/**/.tags* 49 | **/ios/**/.vagrant/ 50 | **/ios/**/DerivedData/ 51 | **/ios/**/Icon? 52 | **/ios/**/Pods/ 53 | **/ios/**/.symlinks/ 54 | **/ios/**/profile 55 | **/ios/**/xcuserdata 56 | **/ios/.generated/ 57 | **/ios/Flutter/App.framework 58 | **/ios/Flutter/Flutter.framework 59 | **/ios/Flutter/Generated.xcconfig 60 | **/ios/Flutter/app.flx 61 | **/ios/Flutter/app.zip 62 | **/ios/Flutter/flutter_assets/ 63 | **/ios/ServiceDefinitions.json 64 | **/ios/Runner/GeneratedPluginRegistrant.* 65 | 66 | # Exceptions to above rules. 67 | !**/ios/**/default.mode1v3 68 | !**/ios/**/default.mode2v3 69 | !**/ios/**/default.pbxuser 70 | !**/ios/**/default.perspectivev3 71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 72 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_orm_demo 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 | -------------------------------------------------------------------------------- /lib/SelectAllDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | 4 | 5 | class SelectAllDemo extends StatefulWidget { 6 | @override 7 | _SelectAllDemoState createState() => _SelectAllDemoState(); 8 | } 9 | 10 | class _SelectAllDemoState extends State{ 11 | 12 | List userList = new List(); 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | Query("Student").all().then((List l) { 18 | setState(() { 19 | userList = l; 20 | }); 21 | }); 22 | 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return new Scaffold( 28 | appBar: new AppBar( 29 | title: new Text("Select Demo"), 30 | ), 31 | body: new ListView.builder( 32 | itemCount: userList.length, 33 | padding: const EdgeInsets.all(10.0), 34 | itemBuilder: (context, i) { 35 | Map data = userList[i]; 36 | return GestureDetector( 37 | child: new Column( 38 | crossAxisAlignment:CrossAxisAlignment.start, 39 | children: [ 40 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 41 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 42 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 43 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 44 | new Divider(), 45 | ], 46 | ), 47 | ); 48 | }, 49 | ), 50 | ); 51 | } 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/WhereSortDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | 4 | 5 | class WhereSortDemo extends StatefulWidget { 6 | @override 7 | _WhereSortDemoState createState() => _WhereSortDemoState(); 8 | } 9 | 10 | class _WhereSortDemoState extends State{ 11 | 12 | List userList = new List(); 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | Query("Student").orderBy(["score desc",]).all().then((List l) { 18 | setState(() { 19 | userList = l; 20 | }); 21 | }); 22 | 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return new Scaffold( 28 | appBar: new AppBar( 29 | title: new Text("Select Demo"), 30 | ), 31 | body: new ListView.builder( 32 | itemCount: userList.length, 33 | padding: const EdgeInsets.all(10.0), 34 | itemBuilder: (context, i) { 35 | Map data = userList[i]; 36 | return GestureDetector( 37 | child: new Column( 38 | crossAxisAlignment:CrossAxisAlignment.start, 39 | children: [ 40 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 41 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 42 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 43 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 44 | new Divider(), 45 | ], 46 | ), 47 | ); 48 | }, 49 | ), 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/SelectFirstDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | 4 | 5 | class SelectFirstDemo extends StatefulWidget { 6 | @override 7 | _SelectFirstDemoState createState() => _SelectFirstDemoState(); 8 | } 9 | 10 | class _SelectFirstDemoState extends State{ 11 | 12 | List userList = new List(); 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | Query("Student").first().then((Map m) { 18 | setState(() { 19 | userList.add(m); 20 | }); 21 | }); 22 | 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return new Scaffold( 28 | appBar: new AppBar( 29 | title: new Text("Select Demo"), 30 | ), 31 | body: new ListView.builder( 32 | itemCount: userList.length, 33 | padding: const EdgeInsets.all(10.0), 34 | itemBuilder: (context, i) { 35 | Map data = userList[i]; 36 | return GestureDetector( 37 | child: new Column( 38 | crossAxisAlignment:CrossAxisAlignment.start, 39 | children: [ 40 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 41 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 42 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 43 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 44 | new Divider(), 45 | ], 46 | ), 47 | ); 48 | }, 49 | ), 50 | ); 51 | } 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /lib/SelectByPrimaryKeyDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | 4 | 5 | class SelectByPrimaryKeyDemo extends StatefulWidget { 6 | @override 7 | _SelectByPrimaryKeyDemoState createState() => _SelectByPrimaryKeyDemoState(); 8 | } 9 | 10 | class _SelectByPrimaryKeyDemoState extends State{ 11 | 12 | List userList = new List(); 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | Query("Student").primaryKey([1,3,5]).all().then((List l) { 18 | setState(() { 19 | userList = l; 20 | }); 21 | }); 22 | 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return new Scaffold( 28 | appBar: new AppBar( 29 | title: new Text("Select Demo"), 30 | ), 31 | body: new ListView.builder( 32 | itemCount: userList.length, 33 | padding: const EdgeInsets.all(10.0), 34 | itemBuilder: (context, i) { 35 | Map data = userList[i]; 36 | return GestureDetector( 37 | child: new Column( 38 | crossAxisAlignment:CrossAxisAlignment.start, 39 | children: [ 40 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 41 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 42 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 43 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 44 | new Divider(), 45 | ], 46 | ), 47 | ); 48 | }, 49 | ), 50 | ); 51 | } 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /lib/WhereSqlDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | 4 | 5 | class WhereSqlDemo extends StatefulWidget { 6 | @override 7 | _WhereSqlDemoState createState() => _WhereSqlDemoState(); 8 | } 9 | 10 | class _WhereSqlDemoState extends State{ 11 | 12 | List userList = new List(); 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | Query("Student").whereBySql("class in (?,?) and score > ?", ["class1","class2",90]).all().then((List l) { 18 | setState(() { 19 | userList = l; 20 | }); 21 | }); 22 | 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return new Scaffold( 28 | appBar: new AppBar( 29 | title: new Text("Select Demo"), 30 | ), 31 | body: new ListView.builder( 32 | itemCount: userList.length, 33 | padding: const EdgeInsets.all(10.0), 34 | itemBuilder: (context, i) { 35 | Map data = userList[i]; 36 | return GestureDetector( 37 | child: new Column( 38 | crossAxisAlignment:CrossAxisAlignment.start, 39 | children: [ 40 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 41 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 42 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 43 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 44 | new Divider(), 45 | ], 46 | ), 47 | ); 48 | }, 49 | ), 50 | ); 51 | } 52 | } 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /lib/SelectPortionColumnsDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | 4 | 5 | class SelectPortionColumnsDemo extends StatefulWidget { 6 | @override 7 | _SelectPortionColumnsDemoState createState() => _SelectPortionColumnsDemoState(); 8 | } 9 | 10 | class _SelectPortionColumnsDemoState extends State{ 11 | 12 | List userList = new List(); 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | Query("Student").needColums(["studentId","name"]).all().then((List l) { 18 | setState(() { 19 | userList = l; 20 | }); 21 | }); 22 | 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return new Scaffold( 28 | appBar: new AppBar( 29 | title: new Text("Select Demo"), 30 | ), 31 | body: new ListView.builder( 32 | itemCount: userList.length, 33 | padding: const EdgeInsets.all(10.0), 34 | itemBuilder: (context, i) { 35 | Map data = userList[i]; 36 | return GestureDetector( 37 | child: new Column( 38 | crossAxisAlignment:CrossAxisAlignment.start, 39 | children: [ 40 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 41 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 42 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 43 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 44 | new Divider(), 45 | ], 46 | ), 47 | ); 48 | }, 49 | ), 50 | ); 51 | } 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /lib/WhereCondictionDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | 4 | 5 | class WhereCondictionDemo extends StatefulWidget { 6 | @override 7 | _WhereCondictionDemoState createState() => _WhereCondictionDemoState(); 8 | } 9 | 10 | class _WhereCondictionDemoState extends State{ 11 | 12 | List userList = new List(); 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | Query("Student").whereByColumFilters([WhereCondiction("score", WhereCondictionType.EQ_OR_MORE_THEN, 90)]).all().then((List l) { 18 | setState(() { 19 | userList = l; 20 | }); 21 | }); 22 | } 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return new Scaffold( 27 | appBar: new AppBar( 28 | title: new Text("Select Demo"), 29 | ), 30 | body: new ListView.builder( 31 | itemCount: userList.length, 32 | padding: const EdgeInsets.all(10.0), 33 | itemBuilder: (context, i) { 34 | Map data = userList[i]; 35 | return GestureDetector( 36 | child: new Column( 37 | crossAxisAlignment:CrossAxisAlignment.start, 38 | children: [ 39 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 40 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 41 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 42 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 43 | new Divider(), 44 | ], 45 | ), 46 | ); 47 | }, 48 | ), 49 | ); 50 | } 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /lib/SelectGroupbyHavingDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | 4 | 5 | class SelectGroupbyHavingDemo extends StatefulWidget { 6 | @override 7 | _SelectGroupbyHavingDemoState createState() => _SelectGroupbyHavingDemoState(); 8 | } 9 | 10 | class _SelectGroupbyHavingDemoState extends State{ 11 | 12 | List userList = new List(); 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | Query("Student").needColums(["class"]).groupBy(["class"]).havingByBindings("avg(score) > ?", [40]).orderBy(["avg(score)"]).all().then((List l) { 18 | setState(() { 19 | userList = l; 20 | }); 21 | }); 22 | } 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return new Scaffold( 27 | appBar: new AppBar( 28 | title: new Text("Select Demo"), 29 | ), 30 | body: new ListView.builder( 31 | itemCount: userList.length, 32 | padding: const EdgeInsets.all(10.0), 33 | itemBuilder: (context, i) { 34 | Map data = userList[i]; 35 | return GestureDetector( 36 | child: new Column( 37 | crossAxisAlignment:CrossAxisAlignment.start, 38 | children: [ 39 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 40 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 41 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 42 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 43 | new Divider(), 44 | ], 45 | ), 46 | ); 47 | }, 48 | ), 49 | ); 50 | } 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /lib/WhereMutiCondictionDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | 4 | 5 | class WhereMutiCondictionDemo extends StatefulWidget { 6 | @override 7 | _WhereMutiCondictionDemoState createState() => _WhereMutiCondictionDemoState(); 8 | } 9 | 10 | class _WhereMutiCondictionDemoState extends State{ 11 | 12 | List userList = new List(); 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | Query("Student").whereByColumFilters([WhereCondiction("score", WhereCondictionType.EQ_OR_MORE_THEN, 90),WhereCondiction("class", WhereCondictionType.IN, ["class1"])]).all().then((List l) { 18 | setState(() { 19 | userList = l; 20 | }); 21 | }); 22 | 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return new Scaffold( 28 | appBar: new AppBar( 29 | title: new Text("Select Demo"), 30 | ), 31 | body: new ListView.builder( 32 | itemCount: userList.length, 33 | padding: const EdgeInsets.all(10.0), 34 | itemBuilder: (context, i) { 35 | Map data = userList[i]; 36 | return GestureDetector( 37 | child: new Column( 38 | crossAxisAlignment:CrossAxisAlignment.start, 39 | children: [ 40 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 41 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 42 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 43 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 44 | new Divider(), 45 | ], 46 | ), 47 | ); 48 | }, 49 | ), 50 | ); 51 | } 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /lib/SelectWhereDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'WhereCondictionDemo.dart'; 3 | import 'WhereMutiCondictionDemo.dart'; 4 | import 'WhereSortDemo.dart'; 5 | import 'WhereSqlDemo.dart'; 6 | 7 | class SelectWhereDemo extends StatefulWidget { 8 | @override 9 | _SelectWhereDemoState createState() => _SelectWhereDemoState(); 10 | } 11 | 12 | class _SelectWhereDemoState extends State{ 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | 18 | } 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | return new Scaffold( 23 | appBar: new AppBar( 24 | title: new Text("Select Demo"), 25 | ), 26 | body: new ListView.builder( 27 | itemCount: 4, 28 | padding: const EdgeInsets.all(10.0), 29 | itemBuilder: (context, i) { 30 | String text = ""; 31 | Widget w; 32 | if(i == 0){ 33 | text = "where by one condition"; 34 | w = new WhereCondictionDemo(); 35 | } else if(i == 1) { 36 | text = "where by muti condition"; 37 | w = new WhereMutiCondictionDemo(); 38 | } else if(i == 2) { 39 | text = "where order by sore desc"; 40 | w = new WhereSortDemo(); 41 | } else if(i == 3) { 42 | text = "where by sql and bind"; 43 | w = new WhereSqlDemo(); 44 | } 45 | 46 | return GestureDetector( 47 | onTap: (){ 48 | Navigator.push( 49 | context, 50 | new MaterialPageRoute(builder: (context) => w), 51 | ); 52 | }, 53 | child: new Column( 54 | crossAxisAlignment:CrossAxisAlignment.start, 55 | children: [ 56 | new ListTile( 57 | title: new Text(text, style: const TextStyle(fontSize: 26.0)), 58 | ), 59 | new Divider(), 60 | ], 61 | ), 62 | ); 63 | }, 64 | ), 65 | ); 66 | } 67 | } 68 | 69 | 70 | -------------------------------------------------------------------------------- /lib/DeleteDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'DeleteAllDemo.dart'; 3 | import 'DeleteByPrimaryKeyDemo.dart'; 4 | import 'DeleteByCondictionsDemo.dart'; 5 | import 'DeleteSqlDemo.dart'; 6 | 7 | class DeleteDemo extends StatefulWidget { 8 | @override 9 | _DeleteDemoState createState() => _DeleteDemoState(); 10 | } 11 | 12 | class _DeleteDemoState extends State { 13 | 14 | @override 15 | void dispose() { 16 | super.dispose(); 17 | } 18 | 19 | @override 20 | void initState() { 21 | super.initState(); 22 | } 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return new Scaffold( 27 | appBar: new AppBar( 28 | title: new Text("Delete Demo"), 29 | ), 30 | body: new ListView.builder( 31 | itemCount:4, 32 | padding: const EdgeInsets.all(10.0), 33 | itemBuilder: (context, i) { 34 | String text = ""; 35 | Widget w; 36 | if(i == 0){ 37 | text = "delete all"; 38 | w = new DeleteAllDemo(); 39 | } else if(i == 1) { 40 | text = "delete by primary key"; 41 | w = new DeleteByPrimaryKeyDemo(); 42 | } else if(i == 2) { 43 | text = "delete by condictions"; 44 | w = new DeleteByCondictionsDemo(); 45 | } else if(i == 3) { 46 | text = "delete by where and binding"; 47 | w = new DeleteSqlDemo(); 48 | } 49 | return GestureDetector( 50 | onTap: (){ 51 | Navigator.push( 52 | context, 53 | new MaterialPageRoute(builder: (context) => w), 54 | ); 55 | }, 56 | child: new Column( 57 | crossAxisAlignment:CrossAxisAlignment.start, 58 | children: [ 59 | new ListTile( 60 | title: new Text(text, style: const TextStyle(fontSize: 26.0)), 61 | ), 62 | new Divider(), 63 | ], 64 | ), 65 | ); 66 | }, 67 | ), 68 | ); 69 | } 70 | } 71 | 72 | 73 | -------------------------------------------------------------------------------- /lib/UpdateAllDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | 4 | 5 | class UpdateAllDemo extends StatefulWidget { 6 | @override 7 | _UpdateAllDemoState createState() => _UpdateAllDemoState(); 8 | } 9 | 10 | class _UpdateAllDemoState extends State{ 11 | 12 | List userList = new List(); 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | Query("Student").all().then((List l) { 18 | setState(() { 19 | userList = l; 20 | }); 21 | }); 22 | 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return new Scaffold( 28 | appBar: new AppBar( 29 | title: new Text("Update Demo"), 30 | ), 31 | floatingActionButton: FloatingActionButton( 32 | onPressed: () { 33 | Query("Student").update({"name":"test all update"}); 34 | Query("Student").all().then((List l) { 35 | setState(() { 36 | userList = l; 37 | }); 38 | }); 39 | }, 40 | child: Text("UPDATE", style: const TextStyle(fontSize: 10.0)), 41 | foregroundColor: Colors.black, 42 | ), 43 | body: new ListView.builder( 44 | itemCount: userList.length, 45 | padding: const EdgeInsets.all(10.0), 46 | itemBuilder: (context, i) { 47 | Map data = userList[i]; 48 | return GestureDetector( 49 | child: new Column( 50 | crossAxisAlignment:CrossAxisAlignment.start, 51 | children: [ 52 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 53 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 54 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 55 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 56 | new Divider(), 57 | ], 58 | ), 59 | ); 60 | }, 61 | ), 62 | ); 63 | } 64 | } 65 | 66 | 67 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 15 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /lib/UpdateSqlDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | 4 | 5 | class UpdateSqlDemo extends StatefulWidget { 6 | @override 7 | _UpdateSqlDemoState createState() => _UpdateSqlDemoState(); 8 | } 9 | 10 | class _UpdateSqlDemoState extends State { 11 | 12 | List userList = new List(); 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | Query("Student").limit(5).all().then((List l) { 18 | setState(() { 19 | userList = l; 20 | }); 21 | }); 22 | 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return new Scaffold( 28 | appBar: new AppBar( 29 | title: new Text("Update Demo"), 30 | ), 31 | floatingActionButton: FloatingActionButton( 32 | onPressed: () { 33 | Query("Student").whereBySql("studentId <= ? and score <= ?", [5,100]).update({"score":0}); 34 | Query("Student").limit(5).all().then((List l) { 35 | setState(() { 36 | userList = l; 37 | }); 38 | }); 39 | }, 40 | child: Text("UPDATE", style: const TextStyle(fontSize: 10.0)), 41 | foregroundColor: Colors.black, 42 | ), 43 | body: new ListView.builder( 44 | itemCount: userList.length, 45 | padding: const EdgeInsets.all(10.0), 46 | itemBuilder: (context, i) { 47 | Map data = userList[i]; 48 | return GestureDetector( 49 | child: new Column( 50 | crossAxisAlignment:CrossAxisAlignment.start, 51 | children: [ 52 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 53 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 54 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 55 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 56 | new Divider(), 57 | ], 58 | ), 59 | ); 60 | }, 61 | ), 62 | ); 63 | } 64 | } 65 | 66 | 67 | -------------------------------------------------------------------------------- /lib/UpdateByPrimaryKeyDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | 4 | 5 | class UpdateByPrimaryKeyDemo extends StatefulWidget { 6 | @override 7 | _UpdateByPrimaryKeyDemoState createState() => _UpdateByPrimaryKeyDemoState(); 8 | } 9 | 10 | class _UpdateByPrimaryKeyDemoState extends State { 11 | 12 | List userList = new List(); 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | Query("Student").primaryKey([11]).all().then((List l) { 18 | setState(() { 19 | userList = l; 20 | }); 21 | }); 22 | 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return new Scaffold( 28 | appBar: new AppBar( 29 | title: new Text("Update Demo"), 30 | ), 31 | floatingActionButton: FloatingActionButton( 32 | onPressed: () { 33 | Query("Student").primaryKey([11]).update({"name":"test update by primary key"}); 34 | Query("Student").primaryKey([11]).all().then((List l) { 35 | setState(() { 36 | userList = l; 37 | }); 38 | }); 39 | }, 40 | child: Text("UPDATE", style: const TextStyle(fontSize: 10.0)), 41 | foregroundColor: Colors.black, 42 | ), 43 | body: new ListView.builder( 44 | itemCount: userList.length, 45 | padding: const EdgeInsets.all(10.0), 46 | itemBuilder: (context, i) { 47 | Map data = userList[i]; 48 | return GestureDetector( 49 | child: new Column( 50 | crossAxisAlignment:CrossAxisAlignment.start, 51 | children: [ 52 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 53 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 54 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 55 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 56 | new Divider(), 57 | ], 58 | ), 59 | ); 60 | }, 61 | ), 62 | ); 63 | } 64 | } 65 | 66 | 67 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 27 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.orm.flutterormdemo" 37 | minSdkVersion 16 38 | targetSdkVersion 27 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | repositories { 58 | 59 | maven { url "https://jitpack.io" } 60 | 61 | } 62 | 63 | dependencies { 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 | implementation 'com.github.williamwen1986:LuakitJitpack:1.0.14' 68 | } 69 | -------------------------------------------------------------------------------- /lib/UpdateByCondictionsDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | 4 | 5 | class UpdateByCondictionsDemo extends StatefulWidget { 6 | @override 7 | _UpdateByCondictionsDemoState createState() => _UpdateByCondictionsDemoState(); 8 | } 9 | 10 | class _UpdateByCondictionsDemoState extends State { 11 | 12 | List userList = new List(); 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | Query("Student").all().then((List l) { 18 | setState(() { 19 | userList = l; 20 | }); 21 | }); 22 | 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return new Scaffold( 28 | appBar: new AppBar( 29 | title: new Text("Update Demo"), 30 | ), 31 | floatingActionButton: FloatingActionButton( 32 | onPressed: () { 33 | Query("Student").whereByColumFilters([WhereCondiction("studentId", WhereCondictionType.LESS_THEN, 5),WhereCondiction("score", WhereCondictionType.EQ_OR_MORE_THEN, 0)]).update({"score":100}); 34 | Query("Student").all().then((List l) { 35 | setState(() { 36 | userList = l; 37 | }); 38 | }); 39 | }, 40 | child: Text("UPDATE", style: const TextStyle(fontSize: 10.0)), 41 | foregroundColor: Colors.black, 42 | ), 43 | body: new ListView.builder( 44 | itemCount: userList.length, 45 | padding: const EdgeInsets.all(10.0), 46 | itemBuilder: (context, i) { 47 | Map data = userList[i]; 48 | return GestureDetector( 49 | child: new Column( 50 | crossAxisAlignment:CrossAxisAlignment.start, 51 | children: [ 52 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 53 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 54 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 55 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 56 | new Divider(), 57 | ], 58 | ), 59 | ); 60 | }, 61 | ), 62 | ); 63 | } 64 | } 65 | 66 | 67 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/JoinDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'InnerJoinDemo.dart'; 3 | import 'LeftJoinDemo.dart'; 4 | import 'ForeignKeyJoinDemo.dart'; 5 | import 'JoinByWhereDemo.dart'; 6 | import 'JoinPortionColumnsDemo.dart'; 7 | import 'JoinByGroupDemo.dart'; 8 | import 'JoinOrderByDemo.dart'; 9 | 10 | class JoinDemo extends StatefulWidget { 11 | @override 12 | _JoinDemoState createState() => _JoinDemoState(); 13 | } 14 | 15 | class _JoinDemoState extends State { 16 | 17 | @override 18 | void dispose() { 19 | super.dispose(); 20 | } 21 | 22 | @override 23 | void initState() { 24 | super.initState(); 25 | } 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | return new Scaffold( 30 | appBar: new AppBar( 31 | title: new Text("Join Demo"), 32 | ), 33 | body: new ListView.builder( 34 | itemCount:7, 35 | padding: const EdgeInsets.all(10.0), 36 | itemBuilder: (context, i) { 37 | String text = ""; 38 | Widget w; 39 | if(i == 0) { 40 | text = "inner join"; 41 | w = new InnerJoinDemo(); 42 | } else if(i == 1){ 43 | text = "left join"; 44 | w = new LeftJoinDemo(); 45 | } else if(i == 2){ 46 | text = "Join foreign key"; 47 | w = new ForeignKeyJoinDemo(); 48 | } else if(i == 3) { 49 | text = "Join where sql"; 50 | w = new JoinByWhereDemo(); 51 | } else if(i == 4) { 52 | text = "Join portion columns"; 53 | w = new JoinPortionColumnsDemo(); 54 | } else if(i == 5) { 55 | text = "Join group by having"; 56 | w = new JoinByGroupDemo(); 57 | } else if(i == 6) { 58 | text = "Join order by"; 59 | w = new JoinOrderByDemo(); 60 | } 61 | return GestureDetector( 62 | onTap: (){ 63 | Navigator.push( 64 | context, 65 | new MaterialPageRoute(builder: (context) => w), 66 | ); 67 | }, 68 | child: new Column( 69 | crossAxisAlignment:CrossAxisAlignment.start, 70 | children: [ 71 | new ListTile( 72 | title: new Text(text, style: const TextStyle(fontSize: 26.0)), 73 | ), 74 | new Divider(), 75 | ], 76 | ), 77 | ); 78 | }, 79 | ), 80 | ); 81 | } 82 | } 83 | 84 | 85 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | source 'https://github.com/williamwen1986/LuakitPod.git' 8 | source 'https://github.com/williamwen1986/curl.git' 9 | 10 | project 'Runner', { 11 | 'Debug' => :debug, 12 | 'Profile' => :release, 13 | 'Release' => :release, 14 | } 15 | 16 | def parse_KV_file(file, separator='=') 17 | file_abs_path = File.expand_path(file) 18 | if !File.exists? file_abs_path 19 | return []; 20 | end 21 | pods_ary = [] 22 | skip_line_start_symbols = ["#", "/"] 23 | File.foreach(file_abs_path) { |line| 24 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 25 | plugin = line.split(pattern=separator) 26 | if plugin.length == 2 27 | podname = plugin[0].strip() 28 | path = plugin[1].strip() 29 | podpath = File.expand_path("#{path}", file_abs_path) 30 | pods_ary.push({:name => podname, :path => podpath}); 31 | else 32 | puts "Invalid plugin specification: #{line}" 33 | end 34 | } 35 | return pods_ary 36 | end 37 | 38 | target 'Runner' do 39 | pod 'curl', '~> 1.0.0' 40 | pod 'LuakitPod/dynamic', '~> 1.0.28' 41 | 42 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 43 | # referring to absolute paths on developers' machines. 44 | system('rm -rf .symlinks') 45 | system('mkdir -p .symlinks/plugins') 46 | 47 | # Flutter Pods 48 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 49 | if generated_xcode_build_settings.empty? 50 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." 51 | end 52 | generated_xcode_build_settings.map { |p| 53 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 54 | symlink = File.join('.symlinks', 'flutter') 55 | File.symlink(File.dirname(p[:path]), symlink) 56 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 57 | end 58 | } 59 | 60 | # Plugin Pods 61 | plugin_pods = parse_KV_file('../.flutter-plugins') 62 | plugin_pods.map { |p| 63 | symlink = File.join('.symlinks', 'plugins', p[:name]) 64 | File.symlink(p[:path], symlink) 65 | pod p[:name], :path => File.join(symlink, 'ios') 66 | } 67 | end 68 | 69 | post_install do |installer| 70 | installer.pods_project.targets.each do |target| 71 | target.build_configurations.each do |config| 72 | config.build_settings['ENABLE_BITCODE'] = 'NO' 73 | end 74 | end 75 | end 76 | -------------------------------------------------------------------------------- /lib/UpdateDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | import 'package:english_words/english_words.dart'; 4 | import 'dart:math'; 5 | import 'UpdateAllDemo.dart'; 6 | import 'UpdateByPrimaryKeyDemo.dart'; 7 | import 'UpdateByCondictionsDemo.dart'; 8 | import 'UpdateSqlDemo.dart'; 9 | 10 | class UpdateDemo extends StatefulWidget { 11 | @override 12 | _UpdateDemoState createState() => _UpdateDemoState(); 13 | } 14 | 15 | class _UpdateDemoState extends State { 16 | 17 | @override 18 | void dispose() { 19 | super.dispose(); 20 | } 21 | 22 | @override 23 | void initState() { 24 | super.initState(); 25 | Query("Student").delete(); 26 | List orms = new List(); 27 | for(int i = 0 ; i < 100 ; i++) { 28 | List words = new List(); 29 | words.addAll(generateWordPairs().take(1)); 30 | WordPair np = words[0]; 31 | String name = np.asString; 32 | int score = Random().nextInt(100); 33 | String className = "class${score%3}"; 34 | Map m = {"name":name, "class":className, "score":score}; 35 | orms.add(m); 36 | } 37 | FlutterOrmPlugin.batchSaveOrms("Student", orms); 38 | } 39 | 40 | @override 41 | Widget build(BuildContext context) { 42 | return new Scaffold( 43 | appBar: new AppBar( 44 | title: new Text("Update Demo"), 45 | ), 46 | body: new ListView.builder( 47 | itemCount:4, 48 | padding: const EdgeInsets.all(10.0), 49 | itemBuilder: (context, i) { 50 | String text = ""; 51 | Widget w; 52 | if(i == 0){ 53 | text = "update all"; 54 | w = new UpdateAllDemo(); 55 | } else if(i == 1) { 56 | text = "update by primary key"; 57 | w = new UpdateByPrimaryKeyDemo(); 58 | } else if(i == 2) { 59 | text = "update by condictions"; 60 | w = new UpdateByCondictionsDemo(); 61 | } else if(i == 3) { 62 | text = "update by where and binding"; 63 | w = new UpdateSqlDemo(); 64 | } 65 | return GestureDetector( 66 | onTap: (){ 67 | Navigator.push( 68 | context, 69 | new MaterialPageRoute(builder: (context) => w), 70 | ); 71 | }, 72 | child: new Column( 73 | crossAxisAlignment:CrossAxisAlignment.start, 74 | children: [ 75 | new ListTile( 76 | title: new Text(text, style: const TextStyle(fontSize: 26.0)), 77 | ), 78 | new Divider(), 79 | ], 80 | ), 81 | ); 82 | }, 83 | ), 84 | ); 85 | } 86 | } 87 | 88 | 89 | -------------------------------------------------------------------------------- /lib/DeleteAllDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | import 'package:english_words/english_words.dart'; 4 | import 'dart:math'; 5 | 6 | class DeleteAllDemo extends StatefulWidget { 7 | @override 8 | _DeleteAllDemoState createState() => _DeleteAllDemoState(); 9 | } 10 | 11 | class _DeleteAllDemoState extends State{ 12 | 13 | List userList = new List(); 14 | 15 | @override 16 | void initState() { 17 | super.initState(); 18 | Query("Student").delete(); 19 | List orms = new List(); 20 | for(int i = 0 ; i < 100 ; i++) { 21 | List words = new List(); 22 | words.addAll(generateWordPairs().take(1)); 23 | WordPair np = words[0]; 24 | String name = np.asString; 25 | int score = Random().nextInt(100); 26 | String className = "class${score%3}"; 27 | Map m = {"name":name, "class":className, "score":score}; 28 | orms.add(m); 29 | } 30 | FlutterOrmPlugin.batchSaveOrms("Student", orms).then((_){ 31 | Query("Student").all().then((List l) { 32 | setState(() { 33 | userList = l; 34 | }); 35 | }); 36 | }); 37 | } 38 | 39 | @override 40 | Widget build(BuildContext context) { 41 | return new Scaffold( 42 | appBar: new AppBar( 43 | title: new Text("Delete Demo"), 44 | ), 45 | floatingActionButton: FloatingActionButton( 46 | onPressed: () { 47 | Query("Student").delete(); 48 | Query("Student").all().then((List l) { 49 | setState(() { 50 | if(l != null) { 51 | userList = l; 52 | } else { 53 | userList = []; 54 | } 55 | }); 56 | }); 57 | }, 58 | child: Text("DELETE", style: const TextStyle(fontSize: 10.0)), 59 | foregroundColor: Colors.black, 60 | ), 61 | body: new ListView.builder( 62 | itemCount: userList.length, 63 | padding: const EdgeInsets.all(10.0), 64 | itemBuilder: (context, i) { 65 | Map data = userList[i]; 66 | return GestureDetector( 67 | child: new Column( 68 | crossAxisAlignment:CrossAxisAlignment.start, 69 | children: [ 70 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 71 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 72 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 73 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 74 | new Divider(), 75 | ], 76 | ), 77 | ); 78 | }, 79 | ), 80 | ); 81 | } 82 | } 83 | 84 | 85 | -------------------------------------------------------------------------------- /lib/SelectDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | import 'package:english_words/english_words.dart'; 4 | import 'dart:math'; 5 | import 'SelectAllDemo.dart'; 6 | import 'SelectFirstDemo.dart'; 7 | import 'SelectByPrimaryKeyDemo.dart'; 8 | import 'SelectWhereDemo.dart'; 9 | import 'SelectPortionColumnsDemo.dart'; 10 | import 'SelectGroupbyHavingDemo.dart'; 11 | 12 | class SelectDemo extends StatefulWidget { 13 | @override 14 | _SelectDemoState createState() => _SelectDemoState(); 15 | } 16 | 17 | class _SelectDemoState extends State { 18 | 19 | @override 20 | void dispose() { 21 | super.dispose(); 22 | } 23 | 24 | @override 25 | void initState() { 26 | super.initState(); 27 | Query("Student").delete(); 28 | List orms = new List(); 29 | for(int i = 0 ; i < 99 ; i++) { 30 | List words = new List(); 31 | words.addAll(generateWordPairs().take(1)); 32 | WordPair np = words[0]; 33 | String name = np.asString; 34 | int score = Random().nextInt(100); 35 | String className = "class${score%3}"; 36 | Map m = {"name":name, "class":className, "score":score}; 37 | orms.add(m); 38 | } 39 | FlutterOrmPlugin.batchSaveOrms("Student", orms); 40 | } 41 | 42 | @override 43 | Widget build(BuildContext context) { 44 | return new Scaffold( 45 | appBar: new AppBar( 46 | title: new Text("Select Demo"), 47 | ), 48 | body: new ListView.builder( 49 | itemCount: 6, 50 | padding: const EdgeInsets.all(10.0), 51 | itemBuilder: (context, i) { 52 | String text = ""; 53 | Widget w; 54 | if(i == 0){ 55 | text = "select all"; 56 | w = new SelectAllDemo(); 57 | } else if(i == 1) { 58 | text = "select first"; 59 | w = new SelectFirstDemo(); 60 | } else if(i == 2) { 61 | text = "select by primary key"; 62 | w = new SelectByPrimaryKeyDemo(); 63 | } else if(i == 3) { 64 | text = "select where"; 65 | w = new SelectWhereDemo(); 66 | } else if(i == 4) { 67 | text = "select portion columns"; 68 | w = new SelectPortionColumnsDemo(); 69 | } else if(i == 5) { 70 | text = "select groupby having"; 71 | w = new SelectGroupbyHavingDemo(); 72 | } 73 | return GestureDetector( 74 | onTap: (){ 75 | Navigator.push( 76 | context, 77 | new MaterialPageRoute(builder: (context) => w), 78 | ); 79 | }, 80 | child: new Column( 81 | crossAxisAlignment:CrossAxisAlignment.start, 82 | children: [ 83 | new ListTile( 84 | title: new Text(text, style: const TextStyle(fontSize: 26.0)), 85 | ), 86 | new Divider(), 87 | ], 88 | ), 89 | ); 90 | }, 91 | ), 92 | ); 93 | } 94 | } 95 | 96 | 97 | -------------------------------------------------------------------------------- /lib/DeleteSqlDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | import 'package:english_words/english_words.dart'; 4 | import 'dart:math'; 5 | 6 | class DeleteSqlDemo extends StatefulWidget { 7 | @override 8 | _DeleteSqlDemoState createState() => _DeleteSqlDemoState(); 9 | } 10 | 11 | class _DeleteSqlDemoState extends State{ 12 | 13 | List userList = new List(); 14 | 15 | @override 16 | void initState() { 17 | super.initState(); 18 | Query("Student").delete(); 19 | List orms = new List(); 20 | for(int i = 0 ; i < 100 ; i++) { 21 | List words = new List(); 22 | words.addAll(generateWordPairs().take(1)); 23 | WordPair np = words[0]; 24 | String name = np.asString; 25 | int score = Random().nextInt(100); 26 | String className = "class${score%3}"; 27 | Map m = {"name":name, "class":className, "score":score}; 28 | orms.add(m); 29 | } 30 | FlutterOrmPlugin.batchSaveOrms("Student", orms).then((_){ 31 | Query("Student").whereByColumFilters([WhereCondiction("studentId", WhereCondictionType.EQ_OR_LESS_THEN, 5)]).all().then((List l) { 32 | setState(() { 33 | if(l != null) { 34 | userList = l; 35 | } else { 36 | userList = []; 37 | } 38 | }); 39 | }); 40 | }); 41 | 42 | } 43 | 44 | @override 45 | Widget build(BuildContext context) { 46 | return new Scaffold( 47 | appBar: new AppBar( 48 | title: new Text("Delete Demo"), 49 | ), 50 | floatingActionButton: FloatingActionButton( 51 | onPressed: () { 52 | Query("Student").whereBySql("studentId in (?,?,?)", [1,3,5]).delete(); 53 | Query("Student").whereByColumFilters([WhereCondiction("studentId", WhereCondictionType.EQ_OR_LESS_THEN, 5)]).all().then((List l) { 54 | setState(() { 55 | if(l != null) { 56 | userList = l; 57 | } else { 58 | userList = []; 59 | } 60 | }); 61 | }); 62 | }, 63 | child: Text("DELETE", style: const TextStyle(fontSize: 10.0)), 64 | foregroundColor: Colors.black, 65 | ), 66 | body: new ListView.builder( 67 | itemCount: userList.length, 68 | padding: const EdgeInsets.all(10.0), 69 | itemBuilder: (context, i) { 70 | Map data = userList[i]; 71 | return GestureDetector( 72 | child: new Column( 73 | crossAxisAlignment:CrossAxisAlignment.start, 74 | children: [ 75 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 76 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 77 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 78 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 79 | new Divider(), 80 | ], 81 | ), 82 | ); 83 | }, 84 | ), 85 | ); 86 | } 87 | } 88 | 89 | 90 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/DeleteByPrimaryKeyDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | import 'package:english_words/english_words.dart'; 4 | import 'dart:math'; 5 | 6 | class DeleteByPrimaryKeyDemo extends StatefulWidget { 7 | @override 8 | _DeleteByPrimaryKeyDemoState createState() => _DeleteByPrimaryKeyDemoState(); 9 | } 10 | 11 | class _DeleteByPrimaryKeyDemoState extends State{ 12 | 13 | List userList = new List(); 14 | 15 | @override 16 | void initState() { 17 | super.initState(); 18 | Query("Student").delete(); 19 | List orms = new List(); 20 | for(int i = 0 ; i < 100 ; i++) { 21 | List words = new List(); 22 | words.addAll(generateWordPairs().take(1)); 23 | WordPair np = words[0]; 24 | String name = np.asString; 25 | int score = Random().nextInt(100); 26 | String className = "class${score%3}"; 27 | Map m = {"name":name, "class":className, "score":score}; 28 | orms.add(m); 29 | } 30 | FlutterOrmPlugin.batchSaveOrms("Student", orms).then((_){ 31 | Query("Student").whereByColumFilters([WhereCondiction("studentId", WhereCondictionType.EQ_OR_LESS_THEN, 5)]).all().then((List l) { 32 | setState(() { 33 | if(l != null) { 34 | userList = l; 35 | } else { 36 | userList = []; 37 | } 38 | }); 39 | }); 40 | }); 41 | } 42 | 43 | @override 44 | Widget build(BuildContext context) { 45 | return new Scaffold( 46 | appBar: new AppBar( 47 | title: new Text("Delete Demo"), 48 | ), 49 | floatingActionButton: FloatingActionButton( 50 | onPressed: () { 51 | Query("Student").primaryKey([1,3,5]).delete(); 52 | Query("Student").whereByColumFilters([WhereCondiction("studentId", WhereCondictionType.EQ_OR_LESS_THEN, 5)]).all().then((List l) { 53 | setState(() { 54 | if(l != null) { 55 | userList = l; 56 | } else { 57 | userList = []; 58 | } 59 | }); 60 | }); 61 | }, 62 | child: Text("DELETE", style: const TextStyle(fontSize: 10.0)), 63 | foregroundColor: Colors.black, 64 | ), 65 | body: new ListView.builder( 66 | itemCount: userList.length, 67 | padding: const EdgeInsets.all(10.0), 68 | itemBuilder: (context, i) { 69 | Map data = userList[i]; 70 | return GestureDetector( 71 | child: new Column( 72 | crossAxisAlignment:CrossAxisAlignment.start, 73 | children: [ 74 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 75 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 76 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 77 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 78 | new Divider(), 79 | ], 80 | ), 81 | ); 82 | }, 83 | ), 84 | ); 85 | } 86 | } 87 | 88 | 89 | -------------------------------------------------------------------------------- /lib/DeleteByCondictionsDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | import 'package:english_words/english_words.dart'; 4 | import 'dart:math'; 5 | 6 | class DeleteByCondictionsDemo extends StatefulWidget { 7 | @override 8 | _DeleteByCondictionsDemoState createState() => _DeleteByCondictionsDemoState(); 9 | } 10 | 11 | class _DeleteByCondictionsDemoState extends State{ 12 | 13 | List userList = new List(); 14 | 15 | @override 16 | void initState() { 17 | super.initState(); 18 | Query("Student").delete(); 19 | List orms = new List(); 20 | for(int i = 0 ; i < 100 ; i++) { 21 | List words = new List(); 22 | words.addAll(generateWordPairs().take(1)); 23 | WordPair np = words[0]; 24 | String name = np.asString; 25 | int score = Random().nextInt(100); 26 | String className = "class${score%3}"; 27 | Map m = {"name":name, "class":className, "score":score}; 28 | orms.add(m); 29 | } 30 | FlutterOrmPlugin.batchSaveOrms("Student", orms).then((_){ 31 | Query("Student").whereByColumFilters([WhereCondiction("studentId", WhereCondictionType.EQ_OR_LESS_THEN, 5)]).all().then((List l) { 32 | setState(() { 33 | if(l != null) { 34 | userList = l; 35 | } else { 36 | userList = []; 37 | } 38 | }); 39 | }); 40 | }); 41 | } 42 | 43 | @override 44 | Widget build(BuildContext context) { 45 | return new Scaffold( 46 | appBar: new AppBar( 47 | title: new Text("Delete Demo"), 48 | ), 49 | floatingActionButton: FloatingActionButton( 50 | onPressed: () { 51 | Query("Student").whereByColumFilters([WhereCondiction("studentId", WhereCondictionType.IN, [1,3,5])]).delete(); 52 | Query("Student").whereByColumFilters([WhereCondiction("studentId", WhereCondictionType.EQ_OR_LESS_THEN, 5)]).all().then((List l) { 53 | setState(() { 54 | if(l != null) { 55 | userList = l; 56 | } else { 57 | userList = []; 58 | } 59 | }); 60 | }); 61 | }, 62 | child: Text("DELETE", style: const TextStyle(fontSize: 10.0)), 63 | foregroundColor: Colors.black, 64 | ), 65 | body: new ListView.builder( 66 | itemCount: userList.length, 67 | padding: const EdgeInsets.all(10.0), 68 | itemBuilder: (context, i) { 69 | Map data = userList[i]; 70 | return GestureDetector( 71 | child: new Column( 72 | crossAxisAlignment:CrossAxisAlignment.start, 73 | children: [ 74 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 75 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 76 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 77 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 78 | new Divider(), 79 | ], 80 | ), 81 | ); 82 | }, 83 | ), 84 | ); 85 | } 86 | } 87 | 88 | 89 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_orm_demo 2 | description: A orm demo Flutter application. 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 | # Read more about versioning at semver.org. 10 | version: 1.0.0+1 11 | 12 | environment: 13 | sdk: ">=2.0.0-dev.68.0 <3.0.0" 14 | 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | english_words: ^3.1.0 19 | flutter_orm_plugin: ^0.3.1 20 | # The following adds the Cupertino Icons font to your application. 21 | # Use with the CupertinoIcons class for iOS style icons. 22 | cupertino_icons: ^0.1.2 23 | 24 | dev_dependencies: 25 | flutter_test: 26 | sdk: flutter 27 | 28 | 29 | # For information on the generic Dart part of this file, see the 30 | # following page: https://www.dartlang.org/tools/pub/pubspec 31 | 32 | # The following section is specific to Flutter. 33 | flutter: 34 | assets: 35 | - packages/flutter_orm_plugin/lua/DB.lua 36 | - packages/flutter_orm_plugin/lua/orm/model.lua 37 | - packages/flutter_orm_plugin/lua/orm/cache.lua 38 | - packages/flutter_orm_plugin/lua/orm/dbData.lua 39 | - packages/flutter_orm_plugin/lua/orm/tools/fields.lua 40 | - packages/flutter_orm_plugin/lua/orm/tools/func.lua 41 | - packages/flutter_orm_plugin/lua/orm/class/fields.lua 42 | - packages/flutter_orm_plugin/lua/orm/class/global.lua 43 | - packages/flutter_orm_plugin/lua/orm/class/property.lua 44 | - packages/flutter_orm_plugin/lua/orm/class/query.lua 45 | - packages/flutter_orm_plugin/lua/orm/class/query_list.lua 46 | - packages/flutter_orm_plugin/lua/orm/class/select.lua 47 | - packages/flutter_orm_plugin/lua/orm/class/table.lua 48 | - packages/flutter_orm_plugin/lua/orm/class/type.lua 49 | 50 | # The following line ensures that the Material Icons font is 51 | # included with your application, so that you can use the icons in 52 | # the material Icons class. 53 | uses-material-design: true 54 | 55 | # To add assets to your application, add an assets section, like this: 56 | # assets: 57 | # - images/a_dot_burr.jpeg 58 | # - images/a_dot_ham.jpeg 59 | 60 | # An image asset can refer to one or more resolution-specific "variants", see 61 | # https://flutter.io/assets-and-images/#resolution-aware. 62 | 63 | # For details regarding adding assets from package dependencies, see 64 | # https://flutter.io/assets-and-images/#from-packages 65 | 66 | # To add custom fonts to your application, add a fonts section here, 67 | # in this "flutter" section. Each entry in this list should have a 68 | # "family" key with the font family name, and a "fonts" key with a 69 | # list giving the asset and other descriptors for the font. For 70 | # example: 71 | # fonts: 72 | # - family: Schyler 73 | # fonts: 74 | # - asset: fonts/Schyler-Regular.ttf 75 | # - asset: fonts/Schyler-Italic.ttf 76 | # style: italic 77 | # - family: Trajan Pro 78 | # fonts: 79 | # - asset: fonts/TrajanPro.ttf 80 | # - asset: fonts/TrajanPro_Bold.ttf 81 | # weight: 700 82 | # 83 | # For details regarding fonts from package dependencies, 84 | # see https://flutter.io/custom-fonts/#from-packages 85 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /lib/InsertDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | import 'package:english_words/english_words.dart'; 4 | import 'dart:math'; 5 | 6 | 7 | class InsertDemo extends StatefulWidget { 8 | @override 9 | _InsertDemoState createState() => _InsertDemoState(); 10 | } 11 | 12 | class _InsertDemoState extends State { 13 | List userList = new List(); 14 | 15 | @override 16 | void initState() { 17 | super.initState(); 18 | Query("Student").delete(); 19 | Query("Student").all().then((List l) { 20 | setState(() { 21 | if(l != null) { 22 | userList = l; 23 | } 24 | }); 25 | }); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return new Scaffold( 31 | appBar: new AppBar( 32 | title: new Text("Insert Demo"), 33 | ), 34 | floatingActionButton: FloatingActionButton( 35 | onPressed: () { 36 | List words = new List(); 37 | words.addAll(generateWordPairs().take(1)); 38 | WordPair np = words[0]; 39 | String name = np.asString; 40 | int score = Random().nextInt(100); 41 | String className = "class${score%3}"; 42 | Map m = {"name":name, "class":className, "score":score}; 43 | FlutterOrmPlugin.saveOrm("Student", m); 44 | Query("Student").all().then((List l) { 45 | setState(() { 46 | userList = l; 47 | }); 48 | }); 49 | }, 50 | child: Text("INSERT", style: const TextStyle(fontSize: 10.0)), 51 | foregroundColor: Colors.black, 52 | ), 53 | body: userList.length <= 0 54 | ? new Center( 55 | child: new RaisedButton( 56 | onPressed: () { 57 | List words = new List(); 58 | words.addAll(generateWordPairs().take(1)); 59 | WordPair np = words[0]; 60 | String name = np.asString; 61 | int score = Random().nextInt(100); 62 | String className = "class${score%3}"; 63 | Map m = {"name":name, "class":className, "score":score}; 64 | FlutterOrmPlugin.saveOrm("Student", m); 65 | Query("Student").all().then((List l) { 66 | setState(() { 67 | userList = l; 68 | }); 69 | }); 70 | }, 71 | child: new Text('Its empty, tap to add first data!'), 72 | ), 73 | ) 74 | : new ListView.builder( 75 | itemCount: userList.length, 76 | padding: const EdgeInsets.all(10.0), 77 | itemBuilder: (context, i) { 78 | Map data = userList[i]; 79 | 80 | List words = new List(); 81 | words.addAll(generateWordPairs().take(1)); 82 | WordPair wp = words[0]; 83 | String t = wp.asString; 84 | 85 | return GestureDetector( 86 | child: new Column( 87 | crossAxisAlignment:CrossAxisAlignment.start, 88 | children: [ 89 | new Text('name : ${data["name"]}', style: const TextStyle(fontSize: 15.0)), 90 | new Text('studentId: ${data["studentId"]}', style: const TextStyle(fontSize: 15.0)), 91 | new Text('class : ${data["class"]}', style: const TextStyle(fontSize: 15.0)), 92 | new Text('score : ${data["score"]}', style: const TextStyle(fontSize: 15.0)), 93 | new Divider(), 94 | ], 95 | ), 96 | ); 97 | }, 98 | ), 99 | ); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | import 'SelectDemo.dart'; 4 | import 'InsertDemo.dart'; 5 | import 'UpdateDemo.dart'; 6 | import 'DeleteDemo.dart'; 7 | import 'JoinDemo.dart'; 8 | 9 | void main() => runApp(MyApp()); 10 | 11 | class MyApp extends StatefulWidget { 12 | @override 13 | _MyAppState createState() => _MyAppState(); 14 | } 15 | 16 | class _MyAppState extends State { 17 | 18 | @override 19 | void initState() { 20 | super.initState(); 21 | 22 | Map fields = new Map(); 23 | fields["studentId"] = Field(FieldType.Integer, primaryKey: true , autoIncrement: true); 24 | fields["name"] = Field(FieldType.Text); 25 | fields["class"] = Field(FieldType.Text, foreignKey: true, to: "School_Class"); 26 | fields["score"] = Field(FieldType.Real); 27 | 28 | Map classFields = new Map(); 29 | classFields["className"] = Field(FieldType.Text, primaryKey: true ); 30 | classFields["teacher"] = Field(FieldType.Text); 31 | 32 | Map matchFields = new Map(); 33 | matchFields["matchId"] = Field(FieldType.Integer, primaryKey: true , autoIncrement: true); 34 | matchFields["matchName"] = Field(FieldType.Text); 35 | matchFields["winnerId"] = Field(FieldType.Integer); 36 | 37 | FlutterOrmPlugin.createTable("School","Match",matchFields); 38 | FlutterOrmPlugin.createTable("School","Class",classFields); 39 | FlutterOrmPlugin.createTable("School","Student",fields); 40 | 41 | // Map user = new Map(); 42 | // user["studentId"] = 1; 43 | // user["name"] = "tom"; 44 | // user["class"] = "class1"; 45 | // user["score"] = 1; 46 | // FlutterOrmPlugin.saveOrm("Student", user); 47 | // 48 | // Query("Student").whereByColumFilters([ 49 | // WhereCondiction("score", WhereCondictionType.IN, [1]) 50 | // ]).delete().then((_){ 51 | // int a = 0; 52 | // }); 53 | 54 | } 55 | 56 | @override 57 | Widget build(BuildContext context) { 58 | return MaterialApp( 59 | home: Scaffold( 60 | appBar: AppBar( 61 | title: const Text('flutter_orm_plugin example app'), 62 | ), 63 | body: Center( 64 | child: new ListView.builder( 65 | itemCount: 5, 66 | padding: const EdgeInsets.all(10.0), 67 | itemBuilder: (context, i) { 68 | String text; 69 | Widget go; 70 | if (i == 0) { 71 | text = "insert"; 72 | go = new InsertDemo(); 73 | } else if(i == 1){ 74 | text = "select"; 75 | go = new SelectDemo(); 76 | } else if(i == 2){ 77 | text = "update"; 78 | go = new UpdateDemo(); 79 | } else if(i == 3){ 80 | text = "delete"; 81 | go = new DeleteDemo(); 82 | } else if(i == 4){ 83 | text = "join"; 84 | go = new JoinDemo(); 85 | } 86 | Widget w = GestureDetector( 87 | child: new ListTile( 88 | title: new Text(text, style: const TextStyle(fontSize: 26.0)), 89 | ), 90 | onTap: (){ 91 | Navigator.push( 92 | context, 93 | new MaterialPageRoute(builder: (context) => go), 94 | ); 95 | }, 96 | ); 97 | return new Column( 98 | crossAxisAlignment:CrossAxisAlignment.start, 99 | children: [ 100 | w, 101 | new Divider(), 102 | ], 103 | ); 104 | }, 105 | ), 106 | ), 107 | ), 108 | ); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /lib/ForeignKeyJoinDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | import 'package:english_words/english_words.dart'; 4 | import 'dart:math'; 5 | 6 | class ForeignKeyJoinDemo extends StatefulWidget { 7 | @override 8 | _ForeignKeyJoinDemoState createState() => _ForeignKeyJoinDemoState(); 9 | } 10 | 11 | class _ForeignKeyJoinDemoState extends State 12 | with SingleTickerProviderStateMixin { 13 | TabController _tabController; 14 | 15 | List userList = new List(); 16 | 17 | List classList = new List(); 18 | 19 | List joinedList = new List(); 20 | 21 | @override 22 | void dispose() { 23 | _tabController.dispose(); 24 | super.dispose(); 25 | } 26 | 27 | @override 28 | void initState() { 29 | super.initState(); 30 | _tabController = new TabController(vsync: this, length: 2); 31 | 32 | Query("Student").delete(); 33 | List orms = new List(); 34 | for (int i = 0; i < 5; i++) { 35 | List words = new List(); 36 | words.addAll(generateWordPairs().take(1)); 37 | WordPair np = words[0]; 38 | String name = np.asString; 39 | int score = Random().nextInt(100); 40 | String className = "class${score % 3}"; 41 | Map m = {"name": name, "class": className, "score": score}; 42 | orms.add(m); 43 | } 44 | FlutterOrmPlugin.batchSaveOrms("Student", orms).then((_){ 45 | Query("Student").all().then((List l) { 46 | setState(() { 47 | userList = l; 48 | }); 49 | }); 50 | }); 51 | 52 | Query("Match").delete(); 53 | Query("Class").delete(); 54 | 55 | List classes = new List(); 56 | for (int i = 0; i < 3; i++) { 57 | List words = new List(); 58 | words.addAll(generateWordPairs().take(1)); 59 | WordPair np = words[0]; 60 | String name = np.asString; 61 | String className = "class$i"; 62 | Map m = {"className": className, "teacher": name}; 63 | classes.add(m); 64 | } 65 | FlutterOrmPlugin.batchSaveOrms("Class", classes).then((_){ 66 | Query("Class").all().then((List l) { 67 | setState(() { 68 | classList = l; 69 | }); 70 | }); 71 | }); 72 | } 73 | 74 | @override 75 | Widget build(BuildContext context) { 76 | return joinedList.length > 0 77 | ? getJoinedWidget(context) 78 | : getTwoClassesWidget(context); 79 | } 80 | 81 | Widget getJoinedWidget(BuildContext context) { 82 | return new Scaffold( 83 | appBar: new AppBar( 84 | title: new Text("Join Demo"), 85 | ), 86 | body: new ListView.builder( 87 | itemCount: joinedList.length, 88 | padding: const EdgeInsets.all(10.0), 89 | itemBuilder: (context, i) { 90 | Map data = joinedList[i]; 91 | Map cls = joinedList[i]["Class"]; 92 | return GestureDetector( 93 | child: new Column( 94 | crossAxisAlignment: CrossAxisAlignment.start, 95 | children: [ 96 | new Text('name : ${data["name"]}', 97 | style: const TextStyle(fontSize: 15.0)), 98 | new Text('studentId: ${data["studentId"]}', 99 | style: const TextStyle(fontSize: 15.0)), 100 | new Text('class : ${data["class"]}', 101 | style: const TextStyle(fontSize: 15.0)), 102 | new Text('score : ${data["score"]}', 103 | style: const TextStyle(fontSize: 15.0)), 104 | new Text('className : ${cls["className"]}', 105 | style: const TextStyle(fontSize: 15.0)), 106 | new Text('teacher: ${cls["teacher"]}', 107 | style: const TextStyle(fontSize: 15.0)), 108 | new Divider(), 109 | ], 110 | ), 111 | ); 112 | }, 113 | ), 114 | ); 115 | } 116 | 117 | Widget getTwoClassesWidget(BuildContext context) { 118 | return new Scaffold( 119 | floatingActionButton: FloatingActionButton( 120 | onPressed: () { 121 | JoinCondiction c = new JoinCondiction("Class"); 122 | c.type = JoinType.INNER; 123 | Query("Student").join(c).all().then((List l) { 124 | setState(() { 125 | joinedList = l; 126 | }); 127 | }); 128 | }, 129 | child: Text("JOIN", style: const TextStyle(fontSize: 10.0)), 130 | foregroundColor: Colors.black, 131 | ), 132 | appBar: new AppBar( 133 | title: new Text('Join demo'), 134 | bottom: new TabBar( 135 | tabs: [ 136 | new Tab( 137 | text: "student", 138 | ), 139 | new Tab( 140 | text: "classes", 141 | ), 142 | ], 143 | controller: _tabController, 144 | ), 145 | ), 146 | body: new TabBarView( 147 | controller: _tabController, 148 | children: [ 149 | new ListView.builder( 150 | itemCount: userList.length, 151 | padding: const EdgeInsets.all(10.0), 152 | itemBuilder: (context, i) { 153 | Map data = userList[i]; 154 | return GestureDetector( 155 | child: new Column( 156 | crossAxisAlignment: CrossAxisAlignment.start, 157 | children: [ 158 | new Text('name : ${data["name"]}', 159 | style: const TextStyle(fontSize: 15.0)), 160 | new Text('studentId: ${data["studentId"]}', 161 | style: const TextStyle(fontSize: 15.0)), 162 | new Text('class : ${data["class"]}', 163 | style: const TextStyle(fontSize: 15.0)), 164 | new Text('score : ${data["score"]}', 165 | style: const TextStyle(fontSize: 15.0)), 166 | new Divider(), 167 | ], 168 | ), 169 | ); 170 | }), 171 | new ListView.builder( 172 | itemCount: classList.length, 173 | padding: const EdgeInsets.all(10.0), 174 | itemBuilder: (context, i) { 175 | Map data = classList[i]; 176 | return GestureDetector( 177 | child: new Column( 178 | crossAxisAlignment: CrossAxisAlignment.start, 179 | children: [ 180 | new Text('className : ${data["className"]}', 181 | style: const TextStyle(fontSize: 15.0)), 182 | new Text('teacher: ${data["teacher"]}', 183 | style: const TextStyle(fontSize: 15.0)), 184 | new Divider(), 185 | ], 186 | ), 187 | ); 188 | }), 189 | ], 190 | ), 191 | ); 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /lib/JoinOrderByDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | import 'package:english_words/english_words.dart'; 4 | import 'dart:math'; 5 | 6 | class JoinOrderByDemo extends StatefulWidget { 7 | @override 8 | _JoinOrderByDemoState createState() => _JoinOrderByDemoState(); 9 | } 10 | 11 | class _JoinOrderByDemoState extends State 12 | with SingleTickerProviderStateMixin { 13 | TabController _tabController; 14 | 15 | List userList = new List(); 16 | 17 | List classList = new List(); 18 | 19 | List joinedList = new List(); 20 | 21 | @override 22 | void dispose() { 23 | _tabController.dispose(); 24 | super.dispose(); 25 | } 26 | 27 | @override 28 | void initState() { 29 | super.initState(); 30 | _tabController = new TabController(vsync: this, length: 2); 31 | 32 | Query("Student").delete(); 33 | List orms = new List(); 34 | for (int i = 0; i < 5; i++) { 35 | List words = new List(); 36 | words.addAll(generateWordPairs().take(1)); 37 | WordPair np = words[0]; 38 | String name = np.asString; 39 | int score = Random().nextInt(100); 40 | String className = "class${score % 3}"; 41 | Map m = {"name": name, "class": className, "score": score}; 42 | orms.add(m); 43 | } 44 | FlutterOrmPlugin.batchSaveOrms("Student", orms).then((_){ 45 | Query("Student").all().then((List l) { 46 | setState(() { 47 | userList = l; 48 | }); 49 | }); 50 | }); 51 | 52 | Query("Match").delete(); 53 | Query("Class").delete(); 54 | 55 | List classes = new List(); 56 | for (int i = 0; i < 3; i++) { 57 | List words = new List(); 58 | words.addAll(generateWordPairs().take(1)); 59 | WordPair np = words[0]; 60 | String name = np.asString; 61 | String className = "class$i"; 62 | Map m = {"className": className, "teacher": name}; 63 | classes.add(m); 64 | } 65 | FlutterOrmPlugin.batchSaveOrms("Class", classes).then((_){ 66 | Query("Class").all().then((List l) { 67 | setState(() { 68 | classList = l; 69 | }); 70 | }); 71 | }); 72 | } 73 | 74 | @override 75 | Widget build(BuildContext context) { 76 | return joinedList.length > 0 77 | ? getJoinedWidget(context) 78 | : getTwoClassesWidget(context); 79 | } 80 | 81 | Widget getJoinedWidget(BuildContext context) { 82 | return new Scaffold( 83 | appBar: new AppBar( 84 | title: new Text("Join Demo"), 85 | ), 86 | body: new ListView.builder( 87 | itemCount: joinedList.length, 88 | padding: const EdgeInsets.all(10.0), 89 | itemBuilder: (context, i) { 90 | Map data = joinedList[i]; 91 | Map cls = joinedList[i]["Class"]; 92 | return GestureDetector( 93 | child: new Column( 94 | crossAxisAlignment: CrossAxisAlignment.start, 95 | children: [ 96 | new Text('name : ${data["name"]}', 97 | style: const TextStyle(fontSize: 15.0)), 98 | new Text('studentId: ${data["studentId"]}', 99 | style: const TextStyle(fontSize: 15.0)), 100 | new Text('class : ${data["class"]}', 101 | style: const TextStyle(fontSize: 15.0)), 102 | new Text('score : ${data["score"]}', 103 | style: const TextStyle(fontSize: 15.0)), 104 | new Text('className : ${cls["className"]}', 105 | style: const TextStyle(fontSize: 15.0)), 106 | new Text('teacher: ${cls["teacher"]}', 107 | style: const TextStyle(fontSize: 15.0)), 108 | new Divider(), 109 | ], 110 | ), 111 | ); 112 | }, 113 | ), 114 | ); 115 | } 116 | 117 | Widget getTwoClassesWidget(BuildContext context) { 118 | return new Scaffold( 119 | floatingActionButton: FloatingActionButton( 120 | onPressed: () { 121 | JoinCondiction c = new JoinCondiction("Class"); 122 | c.type = JoinType.INNER; 123 | Query("Student").join(c).orderBy(["Student.score desc"]).all().then((List l) { 124 | setState(() { 125 | joinedList = l; 126 | }); 127 | }); 128 | }, 129 | child: Text("JOIN", style: const TextStyle(fontSize: 10.0)), 130 | foregroundColor: Colors.black, 131 | ), 132 | appBar: new AppBar( 133 | title: new Text('Join demo'), 134 | bottom: new TabBar( 135 | tabs: [ 136 | new Tab( 137 | text: "student", 138 | ), 139 | new Tab( 140 | text: "classes", 141 | ), 142 | ], 143 | controller: _tabController, 144 | ), 145 | ), 146 | body: new TabBarView( 147 | controller: _tabController, 148 | children: [ 149 | new ListView.builder( 150 | itemCount: userList.length, 151 | padding: const EdgeInsets.all(10.0), 152 | itemBuilder: (context, i) { 153 | Map data = userList[i]; 154 | return GestureDetector( 155 | child: new Column( 156 | crossAxisAlignment: CrossAxisAlignment.start, 157 | children: [ 158 | new Text('name : ${data["name"]}', 159 | style: const TextStyle(fontSize: 15.0)), 160 | new Text('studentId: ${data["studentId"]}', 161 | style: const TextStyle(fontSize: 15.0)), 162 | new Text('class : ${data["class"]}', 163 | style: const TextStyle(fontSize: 15.0)), 164 | new Text('score : ${data["score"]}', 165 | style: const TextStyle(fontSize: 15.0)), 166 | new Divider(), 167 | ], 168 | ), 169 | ); 170 | }), 171 | new ListView.builder( 172 | itemCount: classList.length, 173 | padding: const EdgeInsets.all(10.0), 174 | itemBuilder: (context, i) { 175 | Map data = classList[i]; 176 | return GestureDetector( 177 | child: new Column( 178 | crossAxisAlignment: CrossAxisAlignment.start, 179 | children: [ 180 | new Text('className : ${data["className"]}', 181 | style: const TextStyle(fontSize: 15.0)), 182 | new Text('teacher: ${data["teacher"]}', 183 | style: const TextStyle(fontSize: 15.0)), 184 | new Divider(), 185 | ], 186 | ), 187 | ); 188 | }), 189 | ], 190 | ), 191 | ); 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /lib/JoinByGroupDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | import 'package:english_words/english_words.dart'; 4 | import 'dart:math'; 5 | 6 | class JoinByGroupDemo extends StatefulWidget { 7 | @override 8 | _JoinByGroupDemoState createState() => _JoinByGroupDemoState(); 9 | } 10 | 11 | class _JoinByGroupDemoState extends State 12 | with SingleTickerProviderStateMixin { 13 | TabController _tabController; 14 | 15 | List userList = new List(); 16 | 17 | List classList = new List(); 18 | 19 | List joinedList = new List(); 20 | 21 | @override 22 | void dispose() { 23 | _tabController.dispose(); 24 | super.dispose(); 25 | } 26 | 27 | @override 28 | void initState() { 29 | super.initState(); 30 | _tabController = new TabController(vsync: this, length: 2); 31 | 32 | Query("Student").delete(); 33 | List orms = new List(); 34 | for (int i = 0; i < 99; i++) { 35 | List words = new List(); 36 | words.addAll(generateWordPairs().take(1)); 37 | WordPair np = words[0]; 38 | String name = np.asString; 39 | int score = Random().nextInt(100); 40 | String className = "class${score % 3}"; 41 | Map m = {"name": name, "class": className, "score": score}; 42 | orms.add(m); 43 | } 44 | FlutterOrmPlugin.batchSaveOrms("Student", orms).then((_){ 45 | Query("Student").all().then((List l) { 46 | setState(() { 47 | userList = l; 48 | }); 49 | }); 50 | }); 51 | 52 | print("111"); 53 | Query("Match").delete(); 54 | Query("Class").delete(); 55 | 56 | List classes = new List(); 57 | for (int i = 0; i < 3; i++) { 58 | List words = new List(); 59 | words.addAll(generateWordPairs().take(1)); 60 | WordPair np = words[0]; 61 | String name = np.asString; 62 | String className = "class$i"; 63 | Map m = {"className": className, "teacher": name}; 64 | classes.add(m); 65 | } 66 | FlutterOrmPlugin.batchSaveOrms("Class", classes).then((_){ 67 | Query("Class").all().then((List l) { 68 | setState(() { 69 | classList = l; 70 | }); 71 | }); 72 | }); 73 | } 74 | 75 | @override 76 | Widget build(BuildContext context) { 77 | return joinedList.length > 0 78 | ? getJoinedWidget(context) 79 | : getTwoClassesWidget(context); 80 | } 81 | 82 | Widget getJoinedWidget(BuildContext context) { 83 | return new Scaffold( 84 | appBar: new AppBar( 85 | title: new Text("Join Demo"), 86 | ), 87 | body: new ListView.builder( 88 | itemCount: joinedList.length, 89 | padding: const EdgeInsets.all(10.0), 90 | itemBuilder: (context, i) { 91 | Map data = joinedList[i]; 92 | Map cls = joinedList[i]["Class"]; 93 | return GestureDetector( 94 | child: new Column( 95 | crossAxisAlignment: CrossAxisAlignment.start, 96 | children: [ 97 | new Text('name : ${data["name"]}', 98 | style: const TextStyle(fontSize: 15.0)), 99 | new Text('studentId: ${data["studentId"]}', 100 | style: const TextStyle(fontSize: 15.0)), 101 | new Text('class : ${data["class"]}', 102 | style: const TextStyle(fontSize: 15.0)), 103 | new Text('score : ${data["score"]}', 104 | style: const TextStyle(fontSize: 15.0)), 105 | new Text('className : ${cls["className"]}', 106 | style: const TextStyle(fontSize: 15.0)), 107 | new Text('teacher: ${cls["teacher"]}', 108 | style: const TextStyle(fontSize: 15.0)), 109 | new Divider(), 110 | ], 111 | ), 112 | ); 113 | }, 114 | ), 115 | ); 116 | } 117 | 118 | Widget getTwoClassesWidget(BuildContext context) { 119 | return new Scaffold( 120 | floatingActionButton: FloatingActionButton( 121 | onPressed: () { 122 | JoinCondiction c = new JoinCondiction("Class"); 123 | c.type = JoinType.INNER; 124 | Query("Student").join(c).needColums(["class"]).groupBy(["Student.class"]).havingByBindings("avg(Student.score) > ?", [40]).all().then((List l) { 125 | setState(() { 126 | joinedList = l; 127 | }); 128 | }); 129 | }, 130 | child: Text("JOIN", style: const TextStyle(fontSize: 10.0)), 131 | foregroundColor: Colors.black, 132 | ), 133 | appBar: new AppBar( 134 | title: new Text('Join demo'), 135 | bottom: new TabBar( 136 | tabs: [ 137 | new Tab( 138 | text: "student", 139 | ), 140 | new Tab( 141 | text: "classes", 142 | ), 143 | ], 144 | controller: _tabController, 145 | ), 146 | ), 147 | body: new TabBarView( 148 | controller: _tabController, 149 | children: [ 150 | new ListView.builder( 151 | itemCount: userList.length, 152 | padding: const EdgeInsets.all(10.0), 153 | itemBuilder: (context, i) { 154 | Map data = userList[i]; 155 | return GestureDetector( 156 | child: new Column( 157 | crossAxisAlignment: CrossAxisAlignment.start, 158 | children: [ 159 | new Text('name : ${data["name"]}', 160 | style: const TextStyle(fontSize: 15.0)), 161 | new Text('studentId: ${data["studentId"]}', 162 | style: const TextStyle(fontSize: 15.0)), 163 | new Text('class : ${data["class"]}', 164 | style: const TextStyle(fontSize: 15.0)), 165 | new Text('score : ${data["score"]}', 166 | style: const TextStyle(fontSize: 15.0)), 167 | new Divider(), 168 | ], 169 | ), 170 | ); 171 | }), 172 | new ListView.builder( 173 | itemCount: classList.length, 174 | padding: const EdgeInsets.all(10.0), 175 | itemBuilder: (context, i) { 176 | Map data = classList[i]; 177 | return GestureDetector( 178 | child: new Column( 179 | crossAxisAlignment: CrossAxisAlignment.start, 180 | children: [ 181 | new Text('className : ${data["className"]}', 182 | style: const TextStyle(fontSize: 15.0)), 183 | new Text('teacher: ${data["teacher"]}', 184 | style: const TextStyle(fontSize: 15.0)), 185 | new Divider(), 186 | ], 187 | ), 188 | ); 189 | }), 190 | ], 191 | ), 192 | ); 193 | } 194 | } 195 | -------------------------------------------------------------------------------- /lib/InnerJoinDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | import 'package:english_words/english_words.dart'; 4 | import 'dart:math'; 5 | 6 | class InnerJoinDemo extends StatefulWidget { 7 | @override 8 | _InnerJoinDemoState createState() => _InnerJoinDemoState(); 9 | } 10 | 11 | class _InnerJoinDemoState extends State 12 | with SingleTickerProviderStateMixin { 13 | TabController _tabController; 14 | 15 | List userList = new List(); 16 | 17 | List matchList = new List(); 18 | 19 | List joinedList = new List(); 20 | 21 | @override 22 | void dispose() { 23 | _tabController.dispose(); 24 | super.dispose(); 25 | } 26 | 27 | @override 28 | void initState() { 29 | super.initState(); 30 | _tabController = new TabController(vsync: this, length: 2); 31 | 32 | Query("Student").delete(); 33 | List orms = new List(); 34 | for (int i = 0; i < 5; i++) { 35 | List words = new List(); 36 | words.addAll(generateWordPairs().take(1)); 37 | WordPair np = words[0]; 38 | String name = np.asString; 39 | int score = Random().nextInt(100); 40 | String className = "class${score % 3}"; 41 | Map m = {"name": name, "class": className, "score": score}; 42 | orms.add(m); 43 | } 44 | FlutterOrmPlugin.batchSaveOrms("Student", orms).then((_){ 45 | Query("Student").all().then((List l) { 46 | setState(() { 47 | userList = l; 48 | }); 49 | }); 50 | }); 51 | 52 | Query("Match").delete(); 53 | List matchs = new List(); 54 | for (int i = 0; i < 5; i++) { 55 | List words = new List(); 56 | words.addAll(generateWordPairs().take(1)); 57 | WordPair np = words[0]; 58 | String name = np.asString; 59 | Map m = {"matchName": name, "winnerId": i + 2}; 60 | matchs.add(m); 61 | } 62 | FlutterOrmPlugin.batchSaveOrms("Match", matchs).then((_){ 63 | Query("Match").all().then((List l) { 64 | setState(() { 65 | matchList = l; 66 | }); 67 | }); 68 | }); 69 | } 70 | 71 | @override 72 | Widget build(BuildContext context) { 73 | return joinedList.length > 0 74 | ? getJoinedWidget(context) 75 | : getTwoClassesWidget(context); 76 | } 77 | 78 | Widget getJoinedWidget(BuildContext context) { 79 | return new Scaffold( 80 | appBar: new AppBar( 81 | title: new Text("Join Demo"), 82 | ), 83 | body: new ListView.builder( 84 | itemCount: joinedList.length, 85 | padding: const EdgeInsets.all(10.0), 86 | itemBuilder: (context, i) { 87 | Map data = joinedList[i]; 88 | Map match = joinedList[i]["Match"]; 89 | return GestureDetector( 90 | child: new Column( 91 | crossAxisAlignment: CrossAxisAlignment.start, 92 | children: [ 93 | new Text('name : ${data["name"]}', 94 | style: const TextStyle(fontSize: 15.0)), 95 | new Text('studentId: ${data["studentId"]}', 96 | style: const TextStyle(fontSize: 15.0)), 97 | new Text('class : ${data["class"]}', 98 | style: const TextStyle(fontSize: 15.0)), 99 | new Text('score : ${data["score"]}', 100 | style: const TextStyle(fontSize: 15.0)), 101 | new Text('matchId : ${match["matchId"]}', 102 | style: const TextStyle(fontSize: 15.0)), 103 | new Text('matchName: ${match["matchName"]}', 104 | style: const TextStyle(fontSize: 15.0)), 105 | new Text('winnerId : ${match["winnerId"]}', 106 | style: const TextStyle(fontSize: 15.0)), 107 | new Divider(), 108 | ], 109 | ), 110 | ); 111 | }, 112 | ), 113 | ); 114 | } 115 | 116 | Widget getTwoClassesWidget(BuildContext context) { 117 | return new Scaffold( 118 | floatingActionButton: FloatingActionButton( 119 | onPressed: () { 120 | JoinCondiction c = new JoinCondiction("Match"); 121 | c.type = JoinType.INNER; 122 | c.matchColumns = {"studentId": "winnerId"}; 123 | Query("Student").join(c).all().then((List l) { 124 | setState(() { 125 | joinedList = l; 126 | }); 127 | }); 128 | }, 129 | child: Text("JOIN", style: const TextStyle(fontSize: 10.0)), 130 | foregroundColor: Colors.black, 131 | ), 132 | appBar: new AppBar( 133 | title: new Text('Join demo'), 134 | bottom: new TabBar( 135 | tabs: [ 136 | new Tab( 137 | text: "student", 138 | ), 139 | new Tab( 140 | text: "match winner", 141 | ), 142 | ], 143 | controller: _tabController, 144 | ), 145 | ), 146 | body: new TabBarView( 147 | controller: _tabController, 148 | children: [ 149 | new ListView.builder( 150 | itemCount: userList.length, 151 | padding: const EdgeInsets.all(10.0), 152 | itemBuilder: (context, i) { 153 | Map data = userList[i]; 154 | return GestureDetector( 155 | child: new Column( 156 | crossAxisAlignment: CrossAxisAlignment.start, 157 | children: [ 158 | new Text('name : ${data["name"]}', 159 | style: const TextStyle(fontSize: 15.0)), 160 | new Text('studentId: ${data["studentId"]}', 161 | style: const TextStyle(fontSize: 15.0)), 162 | new Text('class : ${data["class"]}', 163 | style: const TextStyle(fontSize: 15.0)), 164 | new Text('score : ${data["score"]}', 165 | style: const TextStyle(fontSize: 15.0)), 166 | new Divider(), 167 | ], 168 | ), 169 | ); 170 | }), 171 | new ListView.builder( 172 | itemCount: matchList.length, 173 | padding: const EdgeInsets.all(10.0), 174 | itemBuilder: (context, i) { 175 | Map data = matchList[i]; 176 | return GestureDetector( 177 | child: new Column( 178 | crossAxisAlignment: CrossAxisAlignment.start, 179 | children: [ 180 | new Text('matchId : ${data["matchId"]}', 181 | style: const TextStyle(fontSize: 15.0)), 182 | new Text('matchName: ${data["matchName"]}', 183 | style: const TextStyle(fontSize: 15.0)), 184 | new Text('winnerId : ${data["winnerId"]}', 185 | style: const TextStyle(fontSize: 15.0)), 186 | new Divider(), 187 | ], 188 | ), 189 | ); 190 | }), 191 | ], 192 | ), 193 | ); 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /lib/LeftJoinDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | import 'package:english_words/english_words.dart'; 4 | import 'dart:math'; 5 | 6 | class LeftJoinDemo extends StatefulWidget { 7 | @override 8 | _LeftJoinDemoState createState() => _LeftJoinDemoState(); 9 | } 10 | 11 | class _LeftJoinDemoState extends State 12 | with SingleTickerProviderStateMixin { 13 | TabController _tabController; 14 | 15 | List userList = new List(); 16 | 17 | List matchList = new List(); 18 | 19 | List joinedList = new List(); 20 | 21 | @override 22 | void dispose() { 23 | _tabController.dispose(); 24 | super.dispose(); 25 | } 26 | 27 | @override 28 | void initState() { 29 | super.initState(); 30 | _tabController = new TabController(vsync: this, length: 2); 31 | 32 | Query("Student").delete(); 33 | List orms = new List(); 34 | for (int i = 0; i < 5; i++) { 35 | List words = new List(); 36 | words.addAll(generateWordPairs().take(1)); 37 | WordPair np = words[0]; 38 | String name = np.asString; 39 | int score = Random().nextInt(100); 40 | String className = "class${score % 3}"; 41 | Map m = {"name": name, "class": className, "score": score}; 42 | orms.add(m); 43 | } 44 | FlutterOrmPlugin.batchSaveOrms("Student", orms).then((_){ 45 | Query("Student").all().then((List l) { 46 | setState(() { 47 | userList = l; 48 | }); 49 | }); 50 | }); 51 | 52 | Query("Match").delete(); 53 | List matchs = new List(); 54 | for (int i = 0; i < 5; i++) { 55 | List words = new List(); 56 | words.addAll(generateWordPairs().take(1)); 57 | WordPair np = words[0]; 58 | String name = np.asString; 59 | Map m = {"matchName": name, "winnerId": i + 2}; 60 | matchs.add(m); 61 | } 62 | FlutterOrmPlugin.batchSaveOrms("Match", matchs).then((_){ 63 | Query("Match").all().then((List l) { 64 | setState(() { 65 | matchList = l; 66 | }); 67 | }); 68 | }); 69 | } 70 | 71 | @override 72 | Widget build(BuildContext context) { 73 | return joinedList.length > 0 74 | ? getJoinedWidget(context) 75 | : getTwoClassesWidget(context); 76 | } 77 | 78 | Widget getJoinedWidget(BuildContext context) { 79 | return new Scaffold( 80 | appBar: new AppBar( 81 | title: new Text("Join Demo"), 82 | ), 83 | body: new ListView.builder( 84 | itemCount: joinedList.length, 85 | padding: const EdgeInsets.all(10.0), 86 | itemBuilder: (context, i) { 87 | Map data = joinedList[i]; 88 | Map match = joinedList[i]["Match"]; 89 | if(match == null) { 90 | match = {}; 91 | } 92 | return GestureDetector( 93 | child: new Column( 94 | crossAxisAlignment: CrossAxisAlignment.start, 95 | children: [ 96 | new Text('name : ${data["name"]}', 97 | style: const TextStyle(fontSize: 15.0)), 98 | new Text('studentId: ${data["studentId"]}', 99 | style: const TextStyle(fontSize: 15.0)), 100 | new Text('class : ${data["class"]}', 101 | style: const TextStyle(fontSize: 15.0)), 102 | new Text('score : ${data["score"]}', 103 | style: const TextStyle(fontSize: 15.0)), 104 | new Text('matchId : ${match["matchId"]}', 105 | style: const TextStyle(fontSize: 15.0)), 106 | new Text('matchName: ${match["matchName"]}', 107 | style: const TextStyle(fontSize: 15.0)), 108 | new Text('winnerId : ${match["winnerId"]}', 109 | style: const TextStyle(fontSize: 15.0)), 110 | new Divider(), 111 | ], 112 | ), 113 | ); 114 | }, 115 | ), 116 | ); 117 | } 118 | 119 | Widget getTwoClassesWidget(BuildContext context) { 120 | return new Scaffold( 121 | floatingActionButton: FloatingActionButton( 122 | onPressed: () { 123 | JoinCondiction c = new JoinCondiction("Match"); 124 | c.type = JoinType.LEFT; 125 | c.matchColumns = {"studentId": "winnerId"}; 126 | Query("Student").join(c).all().then((List l) { 127 | setState(() { 128 | joinedList = l; 129 | }); 130 | }); 131 | }, 132 | child: Text("JOIN", style: const TextStyle(fontSize: 10.0)), 133 | foregroundColor: Colors.black, 134 | ), 135 | appBar: new AppBar( 136 | title: new Text('Join demo'), 137 | bottom: new TabBar( 138 | tabs: [ 139 | new Tab( 140 | text: "student", 141 | ), 142 | new Tab( 143 | text: "match winner", 144 | ), 145 | ], 146 | controller: _tabController, 147 | ), 148 | ), 149 | body: new TabBarView( 150 | controller: _tabController, 151 | children: [ 152 | new ListView.builder( 153 | itemCount: userList.length, 154 | padding: const EdgeInsets.all(10.0), 155 | itemBuilder: (context, i) { 156 | Map data = userList[i]; 157 | return GestureDetector( 158 | child: new Column( 159 | crossAxisAlignment: CrossAxisAlignment.start, 160 | children: [ 161 | new Text('name : ${data["name"]}', 162 | style: const TextStyle(fontSize: 15.0)), 163 | new Text('studentId: ${data["studentId"]}', 164 | style: const TextStyle(fontSize: 15.0)), 165 | new Text('class : ${data["class"]}', 166 | style: const TextStyle(fontSize: 15.0)), 167 | new Text('score : ${data["score"]}', 168 | style: const TextStyle(fontSize: 15.0)), 169 | new Divider(), 170 | ], 171 | ), 172 | ); 173 | }), 174 | new ListView.builder( 175 | itemCount: matchList.length, 176 | padding: const EdgeInsets.all(10.0), 177 | itemBuilder: (context, i) { 178 | Map data = matchList[i]; 179 | return GestureDetector( 180 | child: new Column( 181 | crossAxisAlignment: CrossAxisAlignment.start, 182 | children: [ 183 | new Text('matchId : ${data["matchId"]}', 184 | style: const TextStyle(fontSize: 15.0)), 185 | new Text('matchName: ${data["matchName"]}', 186 | style: const TextStyle(fontSize: 15.0)), 187 | new Text('winnerId : ${data["winnerId"]}', 188 | style: const TextStyle(fontSize: 15.0)), 189 | new Divider(), 190 | ], 191 | ), 192 | ); 193 | }), 194 | ], 195 | ), 196 | ); 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /lib/JoinPortionColumnsDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | import 'package:english_words/english_words.dart'; 4 | import 'dart:math'; 5 | 6 | class JoinPortionColumnsDemo extends StatefulWidget { 7 | @override 8 | _JoinPortionColumnsDemoState createState() => _JoinPortionColumnsDemoState(); 9 | } 10 | 11 | class _JoinPortionColumnsDemoState extends State 12 | with SingleTickerProviderStateMixin { 13 | TabController _tabController; 14 | 15 | List userList = new List(); 16 | 17 | List matchList = new List(); 18 | 19 | List joinedList = new List(); 20 | 21 | @override 22 | void dispose() { 23 | _tabController.dispose(); 24 | super.dispose(); 25 | } 26 | 27 | @override 28 | void initState() { 29 | super.initState(); 30 | _tabController = new TabController(vsync: this, length: 2); 31 | 32 | Query("Student").delete(); 33 | List orms = new List(); 34 | for (int i = 0; i < 5; i++) { 35 | List words = new List(); 36 | words.addAll(generateWordPairs().take(1)); 37 | WordPair np = words[0]; 38 | String name = np.asString; 39 | int score = Random().nextInt(100); 40 | String className = "class${score % 3}"; 41 | Map m = {"name": name, "class": className, "score": score}; 42 | orms.add(m); 43 | } 44 | FlutterOrmPlugin.batchSaveOrms("Student", orms).then((_){ 45 | Query("Student").all().then((List l) { 46 | setState(() { 47 | userList = l; 48 | }); 49 | }); 50 | }); 51 | 52 | Query("Match").delete(); 53 | List matchs = new List(); 54 | for (int i = 0; i < 5; i++) { 55 | List words = new List(); 56 | words.addAll(generateWordPairs().take(1)); 57 | WordPair np = words[0]; 58 | String name = np.asString; 59 | Map m = {"matchName": name, "winnerId": i + 2}; 60 | matchs.add(m); 61 | } 62 | FlutterOrmPlugin.batchSaveOrms("Match", matchs).then((_){ 63 | Query("Match").all().then((List l) { 64 | setState(() { 65 | matchList = l; 66 | }); 67 | }); 68 | }); 69 | } 70 | 71 | @override 72 | Widget build(BuildContext context) { 73 | return joinedList.length > 0 74 | ? getJoinedWidget(context) 75 | : getTwoClassesWidget(context); 76 | } 77 | 78 | Widget getJoinedWidget(BuildContext context) { 79 | return new Scaffold( 80 | appBar: new AppBar( 81 | title: new Text("Join Demo"), 82 | ), 83 | body: new ListView.builder( 84 | itemCount: joinedList.length, 85 | padding: const EdgeInsets.all(10.0), 86 | itemBuilder: (context, i) { 87 | Map data = joinedList[i]; 88 | Map match = joinedList[i]["Match"]; 89 | return GestureDetector( 90 | child: new Column( 91 | crossAxisAlignment: CrossAxisAlignment.start, 92 | children: [ 93 | new Text('name : ${data["name"]}', 94 | style: const TextStyle(fontSize: 15.0)), 95 | new Text('studentId: ${data["studentId"]}', 96 | style: const TextStyle(fontSize: 15.0)), 97 | new Text('class : ${data["class"]}', 98 | style: const TextStyle(fontSize: 15.0)), 99 | new Text('score : ${data["score"]}', 100 | style: const TextStyle(fontSize: 15.0)), 101 | new Text('matchId : ${match["matchId"]}', 102 | style: const TextStyle(fontSize: 15.0)), 103 | new Text('matchName: ${match["matchName"]}', 104 | style: const TextStyle(fontSize: 15.0)), 105 | new Text('winnerId : ${match["winnerId"]}', 106 | style: const TextStyle(fontSize: 15.0)), 107 | new Divider(), 108 | ], 109 | ), 110 | ); 111 | }, 112 | ), 113 | ); 114 | } 115 | 116 | Widget getTwoClassesWidget(BuildContext context) { 117 | return new Scaffold( 118 | floatingActionButton: FloatingActionButton( 119 | onPressed: () { 120 | JoinCondiction c = new JoinCondiction("Match"); 121 | c.type = JoinType.INNER; 122 | c.matchColumns = {"studentId": "winnerId"}; 123 | Query("Student").join(c).needColums(["name","score"]).all().then((List l) { 124 | setState(() { 125 | joinedList = l; 126 | }); 127 | }); 128 | }, 129 | child: Text("JOIN", style: const TextStyle(fontSize: 10.0)), 130 | foregroundColor: Colors.black, 131 | ), 132 | appBar: new AppBar( 133 | title: new Text('Join demo'), 134 | bottom: new TabBar( 135 | tabs: [ 136 | new Tab( 137 | text: "student", 138 | ), 139 | new Tab( 140 | text: "match winner", 141 | ), 142 | ], 143 | controller: _tabController, 144 | ), 145 | ), 146 | body: new TabBarView( 147 | controller: _tabController, 148 | children: [ 149 | new ListView.builder( 150 | itemCount: userList.length, 151 | padding: const EdgeInsets.all(10.0), 152 | itemBuilder: (context, i) { 153 | Map data = userList[i]; 154 | return GestureDetector( 155 | child: new Column( 156 | crossAxisAlignment: CrossAxisAlignment.start, 157 | children: [ 158 | new Text('name : ${data["name"]}', 159 | style: const TextStyle(fontSize: 15.0)), 160 | new Text('studentId: ${data["studentId"]}', 161 | style: const TextStyle(fontSize: 15.0)), 162 | new Text('class : ${data["class"]}', 163 | style: const TextStyle(fontSize: 15.0)), 164 | new Text('score : ${data["score"]}', 165 | style: const TextStyle(fontSize: 15.0)), 166 | new Divider(), 167 | ], 168 | ), 169 | ); 170 | }), 171 | new ListView.builder( 172 | itemCount: matchList.length, 173 | padding: const EdgeInsets.all(10.0), 174 | itemBuilder: (context, i) { 175 | Map data = matchList[i]; 176 | return GestureDetector( 177 | child: new Column( 178 | crossAxisAlignment: CrossAxisAlignment.start, 179 | children: [ 180 | new Text('matchId : ${data["matchId"]}', 181 | style: const TextStyle(fontSize: 15.0)), 182 | new Text('matchName: ${data["matchName"]}', 183 | style: const TextStyle(fontSize: 15.0)), 184 | new Text('winnerId : ${data["winnerId"]}', 185 | style: const TextStyle(fontSize: 15.0)), 186 | new Divider(), 187 | ], 188 | ), 189 | ); 190 | }), 191 | ], 192 | ), 193 | ); 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /lib/JoinByWhereDemo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_orm_plugin/flutter_orm_plugin.dart'; 3 | import 'package:english_words/english_words.dart'; 4 | import 'dart:math'; 5 | 6 | class JoinByWhereDemo extends StatefulWidget { 7 | @override 8 | _JoinByWhereDemoState createState() => _JoinByWhereDemoState(); 9 | } 10 | 11 | class _JoinByWhereDemoState extends State 12 | with SingleTickerProviderStateMixin { 13 | TabController _tabController; 14 | 15 | List userList = new List(); 16 | 17 | List matchList = new List(); 18 | 19 | List joinedList = new List(); 20 | 21 | @override 22 | void dispose() { 23 | _tabController.dispose(); 24 | super.dispose(); 25 | } 26 | 27 | @override 28 | void initState() { 29 | super.initState(); 30 | _tabController = new TabController(vsync: this, length: 2); 31 | 32 | Query("Student").delete(); 33 | List orms = new List(); 34 | for (int i = 0; i < 5; i++) { 35 | List words = new List(); 36 | words.addAll(generateWordPairs().take(1)); 37 | WordPair np = words[0]; 38 | String name = np.asString; 39 | int score = Random().nextInt(100); 40 | String className = "class${score % 3}"; 41 | Map m = {"name": name, "class": className, "score": score}; 42 | orms.add(m); 43 | } 44 | FlutterOrmPlugin.batchSaveOrms("Student", orms).then((_){ 45 | Query("Student").all().then((List l) { 46 | setState(() { 47 | userList = l; 48 | }); 49 | }); 50 | }); 51 | 52 | Query("Match").delete(); 53 | List matchs = new List(); 54 | for (int i = 0; i < 5; i++) { 55 | List words = new List(); 56 | words.addAll(generateWordPairs().take(1)); 57 | WordPair np = words[0]; 58 | String name = np.asString; 59 | Map m = {"matchName": name, "winnerId": i + 2}; 60 | matchs.add(m); 61 | } 62 | FlutterOrmPlugin.batchSaveOrms("Match", matchs).then((_){ 63 | Query("Match").all().then((List l) { 64 | setState(() { 65 | matchList = l; 66 | }); 67 | }); 68 | }); 69 | } 70 | 71 | @override 72 | Widget build(BuildContext context) { 73 | return joinedList.length > 0 74 | ? getJoinedWidget(context) 75 | : getTwoClassesWidget(context); 76 | } 77 | 78 | Widget getJoinedWidget(BuildContext context) { 79 | return new Scaffold( 80 | appBar: new AppBar( 81 | title: new Text("Join Demo"), 82 | ), 83 | body: new ListView.builder( 84 | itemCount: joinedList.length, 85 | padding: const EdgeInsets.all(10.0), 86 | itemBuilder: (context, i) { 87 | Map data = joinedList[i]; 88 | Map match = joinedList[i]["Match"]; 89 | return GestureDetector( 90 | child: new Column( 91 | crossAxisAlignment: CrossAxisAlignment.start, 92 | children: [ 93 | new Text('name : ${data["name"]}', 94 | style: const TextStyle(fontSize: 15.0)), 95 | new Text('studentId: ${data["studentId"]}', 96 | style: const TextStyle(fontSize: 15.0)), 97 | new Text('class : ${data["class"]}', 98 | style: const TextStyle(fontSize: 15.0)), 99 | new Text('score : ${data["score"]}', 100 | style: const TextStyle(fontSize: 15.0)), 101 | new Text('matchId : ${match["matchId"]}', 102 | style: const TextStyle(fontSize: 15.0)), 103 | new Text('matchName: ${match["matchName"]}', 104 | style: const TextStyle(fontSize: 15.0)), 105 | new Text('winnerId : ${match["winnerId"]}', 106 | style: const TextStyle(fontSize: 15.0)), 107 | new Divider(), 108 | ], 109 | ), 110 | ); 111 | }, 112 | ), 113 | ); 114 | } 115 | 116 | Widget getTwoClassesWidget(BuildContext context) { 117 | return new Scaffold( 118 | floatingActionButton: FloatingActionButton( 119 | onPressed: () { 120 | JoinCondiction c = new JoinCondiction("Match"); 121 | c.type = JoinType.INNER; 122 | c.matchColumns = {"studentId": "winnerId"}; 123 | Query("Student").join(c).whereBySql("Student.score > ?", [60]).all().then((List l) { 124 | setState(() { 125 | if(l != null) { 126 | joinedList = l; 127 | } 128 | }); 129 | }); 130 | }, 131 | child: Text("JOIN", style: const TextStyle(fontSize: 10.0)), 132 | foregroundColor: Colors.black, 133 | ), 134 | appBar: new AppBar( 135 | title: new Text('Join demo'), 136 | bottom: new TabBar( 137 | tabs: [ 138 | new Tab( 139 | text: "student", 140 | ), 141 | new Tab( 142 | text: "match winner", 143 | ), 144 | ], 145 | controller: _tabController, 146 | ), 147 | ), 148 | body: new TabBarView( 149 | controller: _tabController, 150 | children: [ 151 | new ListView.builder( 152 | itemCount: userList.length, 153 | padding: const EdgeInsets.all(10.0), 154 | itemBuilder: (context, i) { 155 | Map data = userList[i]; 156 | return GestureDetector( 157 | child: new Column( 158 | crossAxisAlignment: CrossAxisAlignment.start, 159 | children: [ 160 | new Text('name : ${data["name"]}', 161 | style: const TextStyle(fontSize: 15.0)), 162 | new Text('studentId: ${data["studentId"]}', 163 | style: const TextStyle(fontSize: 15.0)), 164 | new Text('class : ${data["class"]}', 165 | style: const TextStyle(fontSize: 15.0)), 166 | new Text('score : ${data["score"]}', 167 | style: const TextStyle(fontSize: 15.0)), 168 | new Divider(), 169 | ], 170 | ), 171 | ); 172 | }), 173 | new ListView.builder( 174 | itemCount: matchList.length, 175 | padding: const EdgeInsets.all(10.0), 176 | itemBuilder: (context, i) { 177 | Map data = matchList[i]; 178 | return GestureDetector( 179 | child: new Column( 180 | crossAxisAlignment: CrossAxisAlignment.start, 181 | children: [ 182 | new Text('matchId : ${data["matchId"]}', 183 | style: const TextStyle(fontSize: 15.0)), 184 | new Text('matchName: ${data["matchName"]}', 185 | style: const TextStyle(fontSize: 15.0)), 186 | new Text('winnerId : ${data["winnerId"]}', 187 | style: const TextStyle(fontSize: 15.0)), 188 | new Divider(), 189 | ], 190 | ), 191 | ); 192 | }), 193 | ], 194 | ), 195 | ); 196 | } 197 | } 198 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter\_orm\_plugin 2 | 3 | A orm database Flutter plugin. 4 | 5 | 之前发了一篇文章[《手把手教你在Flutter项目优雅的使用ORM数据库》](https://juejin.im/post/5c45c72d6fb9a049d81c2b4c),很多人咨询使用也提了一些宝贵的意见,说不希望要写lua,这样不够优雅,也增加了学习成本。细想了一下,确实是,对flutter项目开发来讲,最好就是纯flutter版的orm框架,于是我就写了一个flutter版的 [orm插件flutter\_orm\_plugin](https://pub.dartlang.org/packages/flutter_orm_plugin) ,使用的[demo](https://github.com/williamwen1986/flutter_orm_demo)我放到github上了,大家可以下载来玩玩。下面我介绍一下flutter\_orm_plugin提供的所有api。 6 | 7 | ![image](https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/master/img/main.jpg) 8 | 9 | ![image](https://raw.githubusercontent.com/williamwen1986/flutter_orm_demo/master/img/select.jpg) 10 | 11 | ## 添加orm表 12 | 13 | 14 | flutter\_orm_plugin中一个orm对应一个表,例如demo中Student表,它所在的db名字叫School,表名叫Student,它包含如下四个字段: 15 | 16 | **studentId** 在数据库中是Integer类型,主键,自增的。 17 | 18 | **name** 在数据库中是Text类型 19 | 20 | **class** 在数据库中是Text类型,是外键,关联的表是另一个表Class表 21 | 22 | **score** 在数据库中是Real类型 23 | 24 | 创建这样的表的代码在demo的[main.dart](https://github.com/williamwen1986/flutter_orm_demo/blob/master/lib/main.dart)中 25 | 26 | ``` 27 | Map fields = new Map(); 28 | fields["studentId"] = Field(FieldType.Integer, primaryKey: true , autoIncrement: true); 29 | fields["name"] = Field(FieldType.Text); 30 | fields["class"] = Field(FieldType.Text, foreignKey: true, to: "School_Class"); 31 | fields["score"] = Field(FieldType.Real); 32 | FlutterOrmPlugin.createTable("School","Student",fields); 33 | ``` 34 | 35 | 数据库中某一列的数据通过Field类定义,我们先看看Field的定义就可以知道我们的orm对象支持哪些属性了 36 | 37 | ``` 38 | class Field { 39 | 40 | final FieldType type;//类型包括Integer、Real、Blob、Char、Text、Boolean 41 | 42 | bool unique;//是否惟一 43 | 44 | int maxLength; 45 | 46 | bool primaryKey;//是否主键 47 | 48 | bool foreignKey;//是否外键 49 | 50 | bool autoIncrement;//是否自增 51 | 52 | String to;//关联外键表,以DBName_TableName命名 53 | 54 | bool index;//是否有索引 55 | } 56 | 57 | ``` 58 | 59 | ## 插入数据 60 | 61 | 单条插入 62 | 63 | ``` 64 | Map m = {"name":"william", "class":"class1", "score":96.5}; 65 | FlutterOrmPlugin.saveOrm("Student", m); 66 | ``` 67 | 68 | 批量插入 69 | 70 | ``` 71 | List orms = new List(); 72 | for(int i = 0 ; i < 100 ; i++) { 73 | Map m = {"name":name, "class":className, "score":score}; 74 | orms.add(m); 75 | } 76 | FlutterOrmPlugin.batchSaveOrms("Student", orms); 77 | 78 | ``` 79 | 80 | ## 查询数据 81 | 82 | 全部查询 83 | 84 | ``` 85 | Query("Student").all().then((List l) { 86 | 87 | }); 88 | 89 | ``` 90 | 91 | 查询第一条 92 | 93 | ``` 94 | Query("Student").first().then((Map m) { 95 | 96 | }); 97 | 98 | ``` 99 | 100 | 根据主键查询 101 | 102 | ``` 103 | Query("Student").primaryKey([1,3,5]).all().then((List l) { 104 | 105 | }); 106 | 107 | ``` 108 | 109 | where条件查询 110 | 111 | ``` 112 | Query("Student").whereByColumFilters([WhereCondiction("score", WhereCondictionType.EQ_OR_MORE_THEN, 90)]).all().then((List l) { 113 | 114 | }); 115 | 116 | ``` 117 | 118 | where sql 语句查询 119 | 120 | ``` 121 | Query("Student").whereBySql("class in (?,?) and score > ?", ["class1","class2",90]).all().then((List l) { 122 | 123 | }); 124 | 125 | ``` 126 | 127 | where 查询并排序 128 | 129 | ``` 130 | Query("Student").orderBy(["score desc",]).all().then((List l) { 131 | 132 | }); 133 | 134 | ``` 135 | 136 | 查询指定列 137 | 138 | ``` 139 | Query("Student").needColums(["studentId","name"]).all().then((List l) { 140 | 141 | }); 142 | 143 | ``` 144 | 145 | group by 、having 查询 146 | 147 | ``` 148 | Query("Student").needColums(["class"]).groupBy(["class"]).havingByBindings("avg(score) > ?", [40]).orderBy(["avg(score)"]).all().then((List l) { 149 | 150 | }); 151 | 152 | ``` 153 | 154 | ## 更新数据 155 | 156 | 全部更新 157 | 158 | ``` 159 | Query("Student").update({"name":"test all update"}); 160 | 161 | ``` 162 | 163 | 根据主键更新 164 | 165 | ``` 166 | Query("Student").primaryKey([11]).update({"name":"test update by primary key"}); 167 | 168 | ``` 169 | 170 | 根据特定条件更新 171 | 172 | ``` 173 | Query("Student").whereByColumFilters([WhereCondiction("studentId", WhereCondictionType.LESS_THEN, 5),WhereCondiction("score", WhereCondictionType.EQ_OR_MORE_THEN, 0)]).update({"score":100}); 174 | 175 | ``` 176 | 177 | 根据自定义where sql更新 178 | 179 | ``` 180 | Query("Student").whereBySql("studentId <= ? and score <= ?", [5,100]).update({"score":0}); 181 | 182 | 183 | ``` 184 | 185 | ## 删除数据 186 | 187 | 全部删除 188 | 189 | ``` 190 | Query("Student").delete(); 191 | 192 | ``` 193 | 194 | 根据主键删除 195 | 196 | ``` 197 | Query("Student").primaryKey([1,3,5]).delete(); 198 | 199 | ``` 200 | 201 | 根据条件删除 202 | 203 | ``` 204 | Query("Student").whereByColumFilters([WhereCondiction("studentId", WhereCondictionType.IN, [1,3,5])]).delete(); 205 | 206 | 207 | ``` 208 | 209 | 根据自定义where sql删除 210 | 211 | ``` 212 | Query("Student").whereBySql("studentId in (?,?,?)", [1,3,5]).delete(); 213 | 214 | 215 | ``` 216 | 217 | ## 联表查询 218 | 219 | inner join 220 | 221 | ``` 222 | JoinCondiction c = new JoinCondiction("Match"); 223 | c.type = JoinType.INNER; 224 | c.matchColumns = {"studentId": "winnerId"}; 225 | Query("Student").join(c).all().then((List l) { 226 | 227 | }); 228 | 229 | ``` 230 | 231 | left join 232 | 233 | ``` 234 | JoinCondiction c = new JoinCondiction("Match"); 235 | c.type = JoinType.LEFT; 236 | c.matchColumns = {"studentId": "winnerId"}; 237 | Query("Student").join(c).all().then((List l) { 238 | 239 | }); 240 | 241 | ``` 242 | 243 | 利用外键联表 244 | 245 | ``` 246 | JoinCondiction c = new JoinCondiction("Class"); 247 | c.type = JoinType.INNER; 248 | Query("Student").join(c).all().then((List l) { 249 | 250 | }); 251 | 252 | ``` 253 | 254 | where sql 联表 255 | 256 | ``` 257 | JoinCondiction c = new JoinCondiction("Match"); 258 | c.type = JoinType.INNER; 259 | c.matchColumns = {"studentId": "winnerId"}; 260 | Query("Student").join(c).whereBySql("Student.score > ?",[60]).all().then((List l) { 261 | 262 | }); 263 | 264 | ``` 265 | 266 | 部分column 联表查询 267 | 268 | ``` 269 | JoinCondiction c = new JoinCondiction("Match"); 270 | c.type = JoinType.INNER; 271 | c.matchColumns = {"studentId": "winnerId"}; 272 | Query("Student").join(c).needColums(["name","score"]).all().then((List l) { 273 | 274 | }); 275 | 276 | ``` 277 | 278 | group by 、having 联表查询 279 | 280 | ``` 281 | JoinCondiction c = new JoinCondiction("Class"); 282 | c.type = JoinType.INNER; 283 | Query("Student").join(c).needColums(["class"]).groupBy(["Student.class"]).havingByBindings("avg(Student.score) > ?", [40]).all().then((List l) { 284 | 285 | }); 286 | 287 | ``` 288 | 289 | order by 联表查询 290 | 291 | ``` 292 | JoinCondiction c = new JoinCondiction("Class"); 293 | c.type = JoinType.INNER; 294 | Query("Student").join(c).orderBy(["Student.score desc"]).all().then((List l) { 295 | 296 | }); 297 | 298 | ``` 299 | 300 | ## 使用介绍 301 | 302 | flutter\_orm\_plugin 已经发布到flutter 插件仓库。只要简单配置即可使用,在yaml文件中加上flutter\_orm\_plugin依赖以及orm框架所需要的lua源文件,flutter\_orm\_plugin会对所有lua代码进行封装,最终使用只需要关心dart接口,对lua是无感的。 303 | 304 | ``` 305 | flutter_orm_plugin: ^0.3.1 306 | 307 | . 308 | . 309 | . 310 | 311 | assets: 312 | - packages/flutter_orm_plugin/lua/DB.lua 313 | - packages/flutter_orm_plugin/lua/orm/model.lua 314 | - packages/flutter_orm_plugin/lua/orm/cache.lua 315 | - packages/flutter_orm_plugin/lua/orm/dbData.lua 316 | - packages/flutter_orm_plugin/lua/orm/tools/fields.lua 317 | - packages/flutter_orm_plugin/lua/orm/tools/func.lua 318 | - packages/flutter_orm_plugin/lua/orm/class/fields.lua 319 | - packages/flutter_orm_plugin/lua/orm/class/global.lua 320 | - packages/flutter_orm_plugin/lua/orm/class/property.lua 321 | - packages/flutter_orm_plugin/lua/orm/class/query.lua 322 | - packages/flutter_orm_plugin/lua/orm/class/query_list.lua 323 | - packages/flutter_orm_plugin/lua/orm/class/select.lua 324 | - packages/flutter_orm_plugin/lua/orm/class/table.lua 325 | - packages/flutter_orm_plugin/lua/orm/class/type.lua 326 | 327 | ``` 328 | 329 | 在ios项目podfile加上luakit 依赖 330 | 331 | ``` 332 | source 'https://github.com/williamwen1986/LuakitPod.git' 333 | source 'https://github.com/williamwen1986/curl.git' 334 | 335 | . 336 | . 337 | . 338 | 339 | pod 'curl', '~> 1.0.0' 340 | pod 'LuakitPod/dynamic', '~> 1.0.28' 341 | 342 | ``` 343 | 344 | 在android项目app的build.gradle加上luakit依赖 345 | 346 | ``` 347 | repositories { 348 | 349 | maven { url "https://jitpack.io" } 350 | 351 | } 352 | 353 | . 354 | . 355 | . 356 | 357 | implementation 'com.github.williamwen1986:LuakitJitpack:1.0.14' 358 | 359 | ``` 360 | 361 | 完成配置即可使用。 362 | -------------------------------------------------------------------------------- /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 | 8EBB809E5950F3763A64F0EF /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD0D2BA6855741FF88DCB030 /* libPods-Runner.a */; }; 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 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 19 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 20 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 21 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 22 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXCopyFilesBuildPhase section */ 26 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 27 | isa = PBXCopyFilesBuildPhase; 28 | buildActionMask = 2147483647; 29 | dstPath = ""; 30 | dstSubfolderSpec = 10; 31 | files = ( 32 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 33 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 34 | ); 35 | name = "Embed Frameworks"; 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXCopyFilesBuildPhase section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 42 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 43 | 29C49A0F70C4C4F75B45BF55 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 44 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 45 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 46 | 5D6EFD794AE85F0A55F89974 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 47 | 6E4FF164263EA4138807DB05 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 48 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 49 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 50 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 51 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 52 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 53 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 54 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 56 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 57 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 58 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 59 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | FD0D2BA6855741FF88DCB030 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 69 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 70 | 8EBB809E5950F3763A64F0EF /* libPods-Runner.a in Frameworks */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | 9740EEB11CF90186004384FC /* Flutter */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 3B80C3931E831B6300D905FE /* App.framework */, 81 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 82 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 83 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 84 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 85 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 86 | ); 87 | name = Flutter; 88 | sourceTree = ""; 89 | }; 90 | 97C146E51CF9000F007C117D = { 91 | isa = PBXGroup; 92 | children = ( 93 | 9740EEB11CF90186004384FC /* Flutter */, 94 | 97C146F01CF9000F007C117D /* Runner */, 95 | 97C146EF1CF9000F007C117D /* Products */, 96 | D0DDD10DB07872273F02EA47 /* Pods */, 97 | BA25D26B3786663F0716D74A /* Frameworks */, 98 | ); 99 | sourceTree = ""; 100 | }; 101 | 97C146EF1CF9000F007C117D /* Products */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 97C146EE1CF9000F007C117D /* Runner.app */, 105 | ); 106 | name = Products; 107 | sourceTree = ""; 108 | }; 109 | 97C146F01CF9000F007C117D /* Runner */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 113 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 114 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 115 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 116 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 117 | 97C147021CF9000F007C117D /* Info.plist */, 118 | 97C146F11CF9000F007C117D /* Supporting Files */, 119 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 120 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 121 | ); 122 | path = Runner; 123 | sourceTree = ""; 124 | }; 125 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 97C146F21CF9000F007C117D /* main.m */, 129 | ); 130 | name = "Supporting Files"; 131 | sourceTree = ""; 132 | }; 133 | BA25D26B3786663F0716D74A /* Frameworks */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | FD0D2BA6855741FF88DCB030 /* libPods-Runner.a */, 137 | ); 138 | name = Frameworks; 139 | sourceTree = ""; 140 | }; 141 | D0DDD10DB07872273F02EA47 /* Pods */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 29C49A0F70C4C4F75B45BF55 /* Pods-Runner.debug.xcconfig */, 145 | 6E4FF164263EA4138807DB05 /* Pods-Runner.release.xcconfig */, 146 | 5D6EFD794AE85F0A55F89974 /* Pods-Runner.profile.xcconfig */, 147 | ); 148 | name = Pods; 149 | path = Pods; 150 | sourceTree = ""; 151 | }; 152 | /* End PBXGroup section */ 153 | 154 | /* Begin PBXNativeTarget section */ 155 | 97C146ED1CF9000F007C117D /* Runner */ = { 156 | isa = PBXNativeTarget; 157 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 158 | buildPhases = ( 159 | D5ACA7E752B1FF826264CBF1 /* [CP] Check Pods Manifest.lock */, 160 | 9740EEB61CF901F6004384FC /* Run Script */, 161 | 97C146EA1CF9000F007C117D /* Sources */, 162 | 97C146EB1CF9000F007C117D /* Frameworks */, 163 | 97C146EC1CF9000F007C117D /* Resources */, 164 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 165 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 166 | D579C5A5D9E8550E32D5B9F6 /* [CP] Embed Pods Frameworks */, 167 | ); 168 | buildRules = ( 169 | ); 170 | dependencies = ( 171 | ); 172 | name = Runner; 173 | productName = Runner; 174 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 175 | productType = "com.apple.product-type.application"; 176 | }; 177 | /* End PBXNativeTarget section */ 178 | 179 | /* Begin PBXProject section */ 180 | 97C146E61CF9000F007C117D /* Project object */ = { 181 | isa = PBXProject; 182 | attributes = { 183 | LastUpgradeCheck = 0910; 184 | ORGANIZATIONNAME = "The Chromium Authors"; 185 | TargetAttributes = { 186 | 97C146ED1CF9000F007C117D = { 187 | CreatedOnToolsVersion = 7.3.1; 188 | }; 189 | }; 190 | }; 191 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 192 | compatibilityVersion = "Xcode 3.2"; 193 | developmentRegion = English; 194 | hasScannedForEncodings = 0; 195 | knownRegions = ( 196 | en, 197 | Base, 198 | ); 199 | mainGroup = 97C146E51CF9000F007C117D; 200 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 201 | projectDirPath = ""; 202 | projectRoot = ""; 203 | targets = ( 204 | 97C146ED1CF9000F007C117D /* Runner */, 205 | ); 206 | }; 207 | /* End PBXProject section */ 208 | 209 | /* Begin PBXResourcesBuildPhase section */ 210 | 97C146EC1CF9000F007C117D /* Resources */ = { 211 | isa = PBXResourcesBuildPhase; 212 | buildActionMask = 2147483647; 213 | files = ( 214 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 215 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 216 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 217 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 218 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 219 | ); 220 | runOnlyForDeploymentPostprocessing = 0; 221 | }; 222 | /* End PBXResourcesBuildPhase section */ 223 | 224 | /* Begin PBXShellScriptBuildPhase section */ 225 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 226 | isa = PBXShellScriptBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | ); 230 | inputPaths = ( 231 | ); 232 | name = "Thin Binary"; 233 | outputPaths = ( 234 | ); 235 | runOnlyForDeploymentPostprocessing = 0; 236 | shellPath = /bin/sh; 237 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 238 | }; 239 | 9740EEB61CF901F6004384FC /* Run Script */ = { 240 | isa = PBXShellScriptBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | ); 244 | inputPaths = ( 245 | ); 246 | name = "Run Script"; 247 | outputPaths = ( 248 | ); 249 | runOnlyForDeploymentPostprocessing = 0; 250 | shellPath = /bin/sh; 251 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 252 | }; 253 | D579C5A5D9E8550E32D5B9F6 /* [CP] Embed Pods Frameworks */ = { 254 | isa = PBXShellScriptBuildPhase; 255 | buildActionMask = 2147483647; 256 | files = ( 257 | ); 258 | inputFileListPaths = ( 259 | ); 260 | inputPaths = ( 261 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", 262 | "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", 263 | ); 264 | name = "[CP] Embed Pods Frameworks"; 265 | outputFileListPaths = ( 266 | ); 267 | outputPaths = ( 268 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | shellPath = /bin/sh; 272 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 273 | showEnvVarsInLog = 0; 274 | }; 275 | D5ACA7E752B1FF826264CBF1 /* [CP] Check Pods Manifest.lock */ = { 276 | isa = PBXShellScriptBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | ); 280 | inputFileListPaths = ( 281 | ); 282 | inputPaths = ( 283 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 284 | "${PODS_ROOT}/Manifest.lock", 285 | ); 286 | name = "[CP] Check Pods Manifest.lock"; 287 | outputFileListPaths = ( 288 | ); 289 | outputPaths = ( 290 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | shellPath = /bin/sh; 294 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 295 | showEnvVarsInLog = 0; 296 | }; 297 | /* End PBXShellScriptBuildPhase section */ 298 | 299 | /* Begin PBXSourcesBuildPhase section */ 300 | 97C146EA1CF9000F007C117D /* Sources */ = { 301 | isa = PBXSourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 305 | 97C146F31CF9000F007C117D /* main.m in Sources */, 306 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 307 | ); 308 | runOnlyForDeploymentPostprocessing = 0; 309 | }; 310 | /* End PBXSourcesBuildPhase section */ 311 | 312 | /* Begin PBXVariantGroup section */ 313 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 314 | isa = PBXVariantGroup; 315 | children = ( 316 | 97C146FB1CF9000F007C117D /* Base */, 317 | ); 318 | name = Main.storyboard; 319 | sourceTree = ""; 320 | }; 321 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 322 | isa = PBXVariantGroup; 323 | children = ( 324 | 97C147001CF9000F007C117D /* Base */, 325 | ); 326 | name = LaunchScreen.storyboard; 327 | sourceTree = ""; 328 | }; 329 | /* End PBXVariantGroup section */ 330 | 331 | /* Begin XCBuildConfiguration section */ 332 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 333 | isa = XCBuildConfiguration; 334 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.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_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INFINITE_RECURSION = YES; 350 | CLANG_WARN_INT_CONVERSION = YES; 351 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 352 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 354 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 355 | CLANG_WARN_STRICT_PROTOTYPES = YES; 356 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 357 | CLANG_WARN_UNREACHABLE_CODE = YES; 358 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 359 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 360 | COPY_PHASE_STRIP = NO; 361 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 362 | ENABLE_NS_ASSERTIONS = NO; 363 | ENABLE_STRICT_OBJC_MSGSEND = YES; 364 | GCC_C_LANGUAGE_STANDARD = gnu99; 365 | GCC_NO_COMMON_BLOCKS = YES; 366 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 367 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 368 | GCC_WARN_UNDECLARED_SELECTOR = YES; 369 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 370 | GCC_WARN_UNUSED_FUNCTION = YES; 371 | GCC_WARN_UNUSED_VARIABLE = YES; 372 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 373 | MTL_ENABLE_DEBUG_INFO = NO; 374 | SDKROOT = iphoneos; 375 | TARGETED_DEVICE_FAMILY = "1,2"; 376 | VALIDATE_PRODUCT = YES; 377 | }; 378 | name = Profile; 379 | }; 380 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 381 | isa = XCBuildConfiguration; 382 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 383 | buildSettings = { 384 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 385 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 386 | DEVELOPMENT_TEAM = S8QB4VV633; 387 | ENABLE_BITCODE = NO; 388 | FRAMEWORK_SEARCH_PATHS = ( 389 | "$(inherited)", 390 | "$(PROJECT_DIR)/Flutter", 391 | ); 392 | INFOPLIST_FILE = Runner/Info.plist; 393 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 394 | LIBRARY_SEARCH_PATHS = ( 395 | "$(inherited)", 396 | "$(PROJECT_DIR)/Flutter", 397 | ); 398 | PRODUCT_BUNDLE_IDENTIFIER = com.orm.flutterOrmDemo; 399 | PRODUCT_NAME = "$(TARGET_NAME)"; 400 | VERSIONING_SYSTEM = "apple-generic"; 401 | }; 402 | name = Profile; 403 | }; 404 | 97C147031CF9000F007C117D /* Debug */ = { 405 | isa = XCBuildConfiguration; 406 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 407 | buildSettings = { 408 | ALWAYS_SEARCH_USER_PATHS = NO; 409 | CLANG_ANALYZER_NONNULL = YES; 410 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 411 | CLANG_CXX_LIBRARY = "libc++"; 412 | CLANG_ENABLE_MODULES = YES; 413 | CLANG_ENABLE_OBJC_ARC = YES; 414 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 415 | CLANG_WARN_BOOL_CONVERSION = YES; 416 | CLANG_WARN_COMMA = YES; 417 | CLANG_WARN_CONSTANT_CONVERSION = YES; 418 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 419 | CLANG_WARN_EMPTY_BODY = YES; 420 | CLANG_WARN_ENUM_CONVERSION = YES; 421 | CLANG_WARN_INFINITE_RECURSION = YES; 422 | CLANG_WARN_INT_CONVERSION = YES; 423 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 424 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 425 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 426 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 427 | CLANG_WARN_STRICT_PROTOTYPES = YES; 428 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 429 | CLANG_WARN_UNREACHABLE_CODE = YES; 430 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 431 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 432 | COPY_PHASE_STRIP = NO; 433 | DEBUG_INFORMATION_FORMAT = dwarf; 434 | ENABLE_STRICT_OBJC_MSGSEND = YES; 435 | ENABLE_TESTABILITY = YES; 436 | GCC_C_LANGUAGE_STANDARD = gnu99; 437 | GCC_DYNAMIC_NO_PIC = NO; 438 | GCC_NO_COMMON_BLOCKS = YES; 439 | GCC_OPTIMIZATION_LEVEL = 0; 440 | GCC_PREPROCESSOR_DEFINITIONS = ( 441 | "DEBUG=1", 442 | "$(inherited)", 443 | ); 444 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 445 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 446 | GCC_WARN_UNDECLARED_SELECTOR = YES; 447 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 448 | GCC_WARN_UNUSED_FUNCTION = YES; 449 | GCC_WARN_UNUSED_VARIABLE = YES; 450 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 451 | MTL_ENABLE_DEBUG_INFO = YES; 452 | ONLY_ACTIVE_ARCH = YES; 453 | SDKROOT = iphoneos; 454 | TARGETED_DEVICE_FAMILY = "1,2"; 455 | }; 456 | name = Debug; 457 | }; 458 | 97C147041CF9000F007C117D /* Release */ = { 459 | isa = XCBuildConfiguration; 460 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 461 | buildSettings = { 462 | ALWAYS_SEARCH_USER_PATHS = NO; 463 | CLANG_ANALYZER_NONNULL = YES; 464 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 465 | CLANG_CXX_LIBRARY = "libc++"; 466 | CLANG_ENABLE_MODULES = YES; 467 | CLANG_ENABLE_OBJC_ARC = YES; 468 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 469 | CLANG_WARN_BOOL_CONVERSION = YES; 470 | CLANG_WARN_COMMA = YES; 471 | CLANG_WARN_CONSTANT_CONVERSION = YES; 472 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 473 | CLANG_WARN_EMPTY_BODY = YES; 474 | CLANG_WARN_ENUM_CONVERSION = YES; 475 | CLANG_WARN_INFINITE_RECURSION = YES; 476 | CLANG_WARN_INT_CONVERSION = YES; 477 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 478 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 479 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 480 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 481 | CLANG_WARN_STRICT_PROTOTYPES = YES; 482 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 483 | CLANG_WARN_UNREACHABLE_CODE = YES; 484 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 485 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 486 | COPY_PHASE_STRIP = NO; 487 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 488 | ENABLE_NS_ASSERTIONS = NO; 489 | ENABLE_STRICT_OBJC_MSGSEND = YES; 490 | GCC_C_LANGUAGE_STANDARD = gnu99; 491 | GCC_NO_COMMON_BLOCKS = YES; 492 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 493 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 494 | GCC_WARN_UNDECLARED_SELECTOR = YES; 495 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 496 | GCC_WARN_UNUSED_FUNCTION = YES; 497 | GCC_WARN_UNUSED_VARIABLE = YES; 498 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 499 | MTL_ENABLE_DEBUG_INFO = NO; 500 | SDKROOT = iphoneos; 501 | TARGETED_DEVICE_FAMILY = "1,2"; 502 | VALIDATE_PRODUCT = YES; 503 | }; 504 | name = Release; 505 | }; 506 | 97C147061CF9000F007C117D /* Debug */ = { 507 | isa = XCBuildConfiguration; 508 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 509 | buildSettings = { 510 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 511 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 512 | ENABLE_BITCODE = NO; 513 | FRAMEWORK_SEARCH_PATHS = ( 514 | "$(inherited)", 515 | "$(PROJECT_DIR)/Flutter", 516 | ); 517 | INFOPLIST_FILE = Runner/Info.plist; 518 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 519 | LIBRARY_SEARCH_PATHS = ( 520 | "$(inherited)", 521 | "$(PROJECT_DIR)/Flutter", 522 | ); 523 | PRODUCT_BUNDLE_IDENTIFIER = com.orm.flutterOrmDemo; 524 | PRODUCT_NAME = "$(TARGET_NAME)"; 525 | VERSIONING_SYSTEM = "apple-generic"; 526 | }; 527 | name = Debug; 528 | }; 529 | 97C147071CF9000F007C117D /* Release */ = { 530 | isa = XCBuildConfiguration; 531 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 532 | buildSettings = { 533 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 534 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 535 | ENABLE_BITCODE = NO; 536 | FRAMEWORK_SEARCH_PATHS = ( 537 | "$(inherited)", 538 | "$(PROJECT_DIR)/Flutter", 539 | ); 540 | INFOPLIST_FILE = Runner/Info.plist; 541 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 542 | LIBRARY_SEARCH_PATHS = ( 543 | "$(inherited)", 544 | "$(PROJECT_DIR)/Flutter", 545 | ); 546 | PRODUCT_BUNDLE_IDENTIFIER = com.orm.flutterOrmDemo; 547 | PRODUCT_NAME = "$(TARGET_NAME)"; 548 | VERSIONING_SYSTEM = "apple-generic"; 549 | }; 550 | name = Release; 551 | }; 552 | /* End XCBuildConfiguration section */ 553 | 554 | /* Begin XCConfigurationList section */ 555 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 556 | isa = XCConfigurationList; 557 | buildConfigurations = ( 558 | 97C147031CF9000F007C117D /* Debug */, 559 | 97C147041CF9000F007C117D /* Release */, 560 | 249021D3217E4FDB00AE95B9 /* Profile */, 561 | ); 562 | defaultConfigurationIsVisible = 0; 563 | defaultConfigurationName = Release; 564 | }; 565 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 566 | isa = XCConfigurationList; 567 | buildConfigurations = ( 568 | 97C147061CF9000F007C117D /* Debug */, 569 | 97C147071CF9000F007C117D /* Release */, 570 | 249021D4217E4FDB00AE95B9 /* Profile */, 571 | ); 572 | defaultConfigurationIsVisible = 0; 573 | defaultConfigurationName = Release; 574 | }; 575 | /* End XCConfigurationList section */ 576 | }; 577 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 578 | } 579 | --------------------------------------------------------------------------------