├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── doc └── assets │ └── DartReduxDemo.gif ├── example ├── README.md ├── counter │ ├── .gitignore │ ├── README.md │ ├── android │ │ ├── .gitignore │ │ ├── .project │ │ ├── app │ │ │ ├── .classpath │ │ │ ├── .project │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── yourcompany │ │ │ │ │ └── example │ │ │ │ │ └── MainActivity.java │ │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── settings.gradle │ ├── ios │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ ├── Release.xcconfig │ │ │ └── flutter_assets │ │ │ │ ├── AssetManifest.json │ │ │ │ ├── FontManifest.json │ │ │ │ ├── LICENSE │ │ │ │ ├── fonts │ │ │ │ └── MaterialIcons-Regular.ttf │ │ │ │ ├── isolate_snapshot_data │ │ │ │ ├── kernel_blob.bin │ │ │ │ ├── platform_strong.dill │ │ │ │ └── vm_snapshot_data │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ └── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── Runner │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.m │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ └── main.m │ ├── lib │ │ └── main.dart │ └── pubspec.yaml └── githubsearch │ ├── .gitignore │ ├── .idea │ ├── libraries │ │ ├── Dart_SDK.xml │ │ └── Flutter_for_Android.xml │ ├── modules.xml │ ├── runConfigurations │ │ └── main_dart.xml │ └── workspace.xml │ ├── .metadata │ ├── README.md │ ├── android │ ├── .gitignore │ ├── .project │ ├── app │ │ ├── .classpath │ │ ├── .project │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── githubsearch │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle │ ├── githubsearch.iml │ ├── githubsearch_android.iml │ ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ └── contents.xcworkspacedata │ └── Runner │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── main.m │ ├── lib │ ├── SearchResult.dart │ ├── SearchResult.g.dart │ ├── SearchState.dart │ ├── SearchState.g.dart │ ├── empty_result_widget.dart │ ├── github_search_api.dart │ ├── github_search_widget.dart │ ├── main.dart │ ├── redux.dart │ ├── search_error_widget.dart │ ├── search_intro_widget.dart │ ├── search_loading_widget.dart │ └── search_result_widget.dart │ ├── pubspec.yaml │ └── test │ └── widget_test.dart ├── lib ├── redux_remote_devtools.dart └── src │ ├── action_decoder.dart │ ├── action_encoder.dart │ ├── remote_devtools_middleware.dart │ ├── socketcluster_wrapper.dart │ └── state_encoder.dart ├── pubspec.yaml ├── test ├── action_decoder_test.dart ├── action_encoder_test.dart ├── remote_devtools_middleware_test.dart ├── remote_devtools_middleware_test.mocks.dart ├── socketcluster_wrapper_test.dart ├── socketcluster_wrapper_test.mocks.dart ├── state_encoder_test.dart └── test_all.dart └── tool └── travis.sh /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/vim,code,dart 3 | 4 | ### Code ### 5 | # Visual Studio Code - https://code.visualstudio.com/ 6 | .settings/ 7 | .vscode/ 8 | tsconfig.json 9 | jsconfig.json 10 | 11 | ### Dart ### 12 | # See https://www.dartlang.org/guides/libraries/private-files 13 | 14 | # Files and directories created by pub 15 | .dart_tool/ 16 | .packages 17 | build/ 18 | # If you're building an application, you may want to check-in your pubspec.lock 19 | pubspec.lock 20 | 21 | # Directory created by dartdoc 22 | # If you don't generate documentation locally you can remove this line. 23 | doc/api/ 24 | 25 | # Avoid committing generated Javascript files: 26 | *.dart.js 27 | *.info.json # Produced by the --dump-info flag. 28 | *.js # When generated by dart2js. Don't specify *.js if your 29 | # project includes source files written in JavaScript. 30 | *.js_ 31 | *.js.deps 32 | *.js.map 33 | 34 | ### Vim ### 35 | # Swap 36 | [._]*.s[a-v][a-z] 37 | [._]*.sw[a-p] 38 | [._]s[a-rt-v][a-z] 39 | [._]ss[a-gi-z] 40 | [._]sw[a-p] 41 | 42 | # Session 43 | Session.vim 44 | 45 | # Temporary 46 | .netrwhist 47 | *~ 48 | # Auto-generated tag files 49 | tags 50 | # Persistent undo 51 | [._]*.un~ 52 | 53 | 54 | # End of https://www.gitignore.io/api/vim,code,dart 55 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: dart 2 | dart: 3 | - '2.12.0' 4 | install: 5 | - gem install coveralls-lcov 6 | script: ./tool/travis.sh 7 | after_success: 8 | - coveralls-lcov var/lcov.info 9 | env: 10 | - DARTANALYZER_FLAGS=--fatal-warnings 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 3.0.0 2 | 3 | ## Sound Null Safety 4 | 5 | This release migrates Remote DevTools to Dart's new null safety. The changes are mostly internal, so this new release should slot into your previous code, once you have migrated your project to null safety.o 6 | 7 | Note that going forward I will not be doing fixes or new features on the 2.x branch - Null Safety is the Future. 8 | 9 | # 2.0.0 10 | 11 | ## Breaking Change 12 | 13 | Replaces the abstract classes `StateEncoder`, `ActionEncoder`, and `ActionDecoder` with function typedefs. 14 | This is inline with the [Dart styleguide](http://dart-lang.github.io/linter/lints/one_member_abstracts.html), which advocates using function typedefs instead of single method abstract classes. 15 | 16 | **This will only affect you if you are using custom encoders/decoders. No changes if you are using remote devtools as-is.** 17 | 18 | Before: 19 | 20 | ```dart 21 | class MyActionEncoder extends ActionEncoder { 22 | String encode(dynamic action) { 23 | // custom encoding logic here... 24 | } 25 | } 26 | ``` 27 | 28 | After: 29 | 30 | ```dart 31 | ActionEncoder MyActionEncoder = (dynamic action) { 32 | // custom encoding logic here 33 | } 34 | ``` 35 | 36 | Again, for most people this will require no changes to code. 37 | 38 | # 1.0.4 39 | 40 | - Updates pubspec to get those sweet sweet Pub Points 41 | - No functional changes 42 | 43 | # 1.0.3 44 | 45 | - Updates documentation. No functional changes 46 | 47 | # 1.0.2 48 | 49 | - Adds analysis_options.yaml and fixes warnings. No functional changes 50 | 51 | # 1.0.1 52 | 53 | - Allows use of latest redux_devtools 54 | - Clean up code to get that pub.dev health rating up 55 | 56 | # 1.0.0 57 | 58 | - Allows support for Redux 4.0.0 (backwards compatible with 3) 59 | - Switching to semver versioning 60 | 61 | # 0.0.11 62 | 63 | - Updates dependency to latest socketcluster_client and makes this package work 64 | on Flutter mobile again 65 | 66 | # 0.0.10 67 | 68 | - Updates dependency to latest socketcluster_client 69 | 70 | # 0.0.9 71 | 72 | - Resolves an issue where the connect function returned when the http 73 | connection was established, instead of after the connect handshake 74 | completed. This was causing the first few actions to be missing from 75 | devtools. Thanks to @dennis-tra for fixing this. 76 | 77 | # 0.0.8 78 | 79 | - Backwards compatible Update to support changes to Dart API (thanks @tvolkert) 80 | 81 | ## 0.0.7 82 | 83 | - add support for receiving remote actions from the devtools ui. big thanks to @kadza for helping work through this feature 84 | 85 | ## 0.0.6 86 | 87 | - Correctly handle the START response message 88 | 89 | ## 0.0.5 90 | 91 | - Send current state to devtools on connect 92 | 93 | ## 0.0.4 94 | 95 | - Update Documentation 96 | 97 | ## 0.0.3 98 | 99 | - Specify minimum version of socketcluster_client 100 | 101 | ## 0.0.2 102 | 103 | - Use socketcluster_client from pub. 104 | 105 | ## 0.0.1 - Initial Release 106 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at michael@20papercups.net. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Michael Marner 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Redux Remote Devtools for Dart and Flutter 2 | 3 | [![Build Status](https://travis-ci.com/MichaelMarner/dart-redux-remote-devtools.svg?branch=master)](https://travis-ci.com/MichaelMarner/dart-redux-remote-devtools) [![Coverage Status](https://coveralls.io/repos/github/MichaelMarner/dart-redux-remote-devtools/badge.svg?branch=master)](https://coveralls.io/github/MichaelMarner/dart-redux-remote-devtools?branch=master) 4 | 5 | Redux Remote Devtools support for Dart and Flutter. 6 | 7 | ![Devtools Demo](https://github.com/MichaelMarner/dart-redux-remote-devtools/raw/master/doc/assets/DartReduxDemo.gif) 8 | 9 | ## Installation 10 | 11 | Add the library to pubspec.yaml: 12 | 13 | ```yaml 14 | dependencies: 15 | redux_remote_devtools: ^2.0.0 16 | ``` 17 | 18 | ## Middleware configuration 19 | 20 | Add the middleware to your Redux configuration: 21 | 22 | ```dart 23 | var remoteDevtools = RemoteDevToolsMiddleware('192.168.1.52:8000'); 24 | final store = new DevToolsStore(searchReducer, 25 | middleware: [ 26 | remoteDevtools, 27 | ]); 28 | remoteDevtools.store = store; 29 | await remoteDevtools.connect(); 30 | ``` 31 | 32 | > :warning: **Using mutliple middleware?** 33 | > 34 | > If you use other middleware, RemoteDevTools _must_ be put last. Otherwise, 35 | > actions and state updates will be out of sync 36 | 37 | ### What's going on here? 38 | 39 | 1. Create a new instance of the devtools middleware. Specify the host and port to connect to. 40 | 41 | 1. Wait for devtools to connect to the remotedev server 42 | 43 | 1. Initialise your store. To take advantage of time travel, you should use a [DevToolsStore](https://pub.dev/packages/redux_dev_tools). Pass in remoteDevTools with the rest of your middlware 44 | 45 | 1. The middleware needs a reference to the store you just created, so commands from devtools can be dispatched. So as a final step, set the reference. 46 | 47 | ## Using remotedev 48 | 49 | Use the Javascript [Remote Devtools](https://github.com/zalmoxisus/remotedev-server) package. Start the remotedev server on your machine 50 | 51 | ```bash 52 | npm install -g remotedev-server 53 | remotedev --port 8000 54 | ``` 55 | 56 | Run your application. It will connect to the remotedev server. You can now debug your redux application by opening up `http://localhost:8000` in a web browser. 57 | 58 | ## Encoding Actions and State 59 | 60 | In the Javascript world, Redux follows a convention that your redux state is a plain Javascript Object, and actions are also Javascript objects that have a `type` property. The JS Redux Devtools expect this. However, Redux.dart tries to take advantage of the strong typing available in Dart. To make Redux.dart work with the JS devtools, we need to convert actions and state instances to JSON before sending. 61 | 62 | Remember that the primary reason for using devtools is to allow the developer to reason about what the app is doing. Therefore, exact conversion is not strictly necessary - it's more important for what appears in devtools to be meaningful to the developer. 63 | 64 | ### Enconding Strategy for Actions 65 | 66 | We use the class name as the action `type` for class based actions. For enum typed actions, we use the value of the action. For example: 67 | 68 | ```dart 69 | enum EnumActions { 70 | Action1; 71 | Action2; 72 | } 73 | 74 | class ClassAction {} 75 | ``` 76 | 77 | When converted, these actions will be `{"type": "Action1"}` or `{"type": "ClassAction"}`, etc. 78 | 79 | We also want to send the action properties over to devtools. To do this, we attempt to `jsonEncode` the entire Action, and attach this JSON data as a `payload` property. For example: 80 | 81 | ```dart 82 | class ClassAction { 83 | int someValue; 84 | 85 | toJson() { 86 | return {'someValue': this.someValue}; 87 | } 88 | } 89 | ``` 90 | 91 | Would appear in devtools as: 92 | 93 | ```js 94 | { 95 | "type": "ClassAction", 96 | "payload": { 97 | "someValue": 5 // or whatever someValue was set to 98 | }, 99 | } 100 | ``` 101 | 102 | This of course means your Actions need to be json encodable. You can do what the example above does and write your own `toJson` method. However, a better approach is to use a generator like [json_serializable](https://pub.dev/packages/json_serializable) to do it for you. If your action is not json encodable, the payload property will be missing in devtools. 103 | 104 | ### Encoding strategy for State 105 | 106 | For state, we simply attempt to `jsonEncode` the entire thing. If your state cannot be converted, then state updates will not appear in devtools. 107 | 108 | ### Overriding these strategies 109 | 110 | The strategy described above should work for most cases. However, if you want to do something different, you can replace the `ActionEncoder` and `StateEncoder` with your own implementations: 111 | 112 | ```dart 113 | var remoteDevtools = RemoteDevToolsMiddleware('192.168.1.52:8000', actionEncoder: MyCoolActionEncoder); 114 | ``` 115 | 116 | ## Making your actions and state json encodable 117 | 118 | You can either write your own `toJson` methods for each of your actions and your state class. However, this quickly becomes cumbersome and error prone. Instead, the recommended way is to make use of the `json_annotation` package to automatically generate toJson functions for you. 119 | 120 | ## Dispatching Actions from DevTools 121 | 122 | You are able to dispatch actions from the Devtools UI and have these processed by the redux implementation in your Flutter app. 123 | 124 | In order for this to work, you need to implement an `ActionDecoder`. ActionDecoder's job is to take the JSON data received from the Devtools UI, and return an action that your reducers know how to use. For example if we dispatch an action: 125 | 126 | ```json 127 | { 128 | "type": "INCREMENT" 129 | } 130 | ``` 131 | 132 | We would implement an ActionDecoder like so: 133 | 134 | ```dart 135 | ActionDecoder myDecoder = (dynamic payload) { 136 | final map = payload as Map; 137 | if (map['type'] == 'INCREMENT') { 138 | return IncrementAction(); 139 | } 140 | }; 141 | ``` 142 | 143 | Essentially, you need to map every JSON action type into an action that can be used by your reducers. 144 | 145 | Please get in touch if you have any awesome ideas for how to make this process smoother. 146 | 147 | # Example Apps 148 | 149 | This repo includes remote-devtools enabled versions of the flutter-redux example apps: 150 | 151 | - [flutter-redux Simple Counter App](https://github.com/MichaelMarner/dart-redux-remote-devtools/tree/master/example/counter). 152 | 153 | - Demonstrates how enum actions are sent to devtools. 154 | - Shows how time travel works. 155 | 156 | * [flutter-redux Github Search App](https://github.com/MichaelMarner/dart-redux-remote-devtools/tree/master/example/githubsearch). 157 | 158 | - Demonstrates how class based actions and nested state objects are serialised and made browseable in devtools 159 | 160 | - Demonstrates the limits of time travel in apps that use epics 161 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # Defines a default set of lint rules enforced for 2 | # projects at Google. For details and rationale, 3 | # see https://github.com/dart-lang/pedantic#enabled-lints. 4 | include: package:pedantic/analysis_options.yaml 5 | # For lint rules and documentation, see http://dart-lang.github.io/linter/lints. 6 | # Uncomment to specify additional rules. 7 | # linter: 8 | # rules: 9 | # - camel_case_types 10 | 11 | analyzer: 12 | exclude: 13 | - example/*/** 14 | -------------------------------------------------------------------------------- /doc/assets/DartReduxDemo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/doc/assets/DartReduxDemo.gif -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # Example Apps 2 | 3 | This repo includes remote-devtools enabled versions of the flutter-redux example apps: 4 | 5 | - [flutter-redux Simple Counter App](https://github.com/MichaelMarner/dart-redux-remote-devtools/tree/master/example/counter). 6 | 7 | - Demonstrates how enum actions are sent to devtools. 8 | - Shows how time travel works. 9 | 10 | * [flutter-redux Github Search App](https://github.com/MichaelMarner/dart-redux-remote-devtools/tree/master/example/githubsearch). 11 | 12 | - Demonstrates how class based actions and nested state objects are serialised and made browseable in devtools 13 | 14 | - Demonstrates the limits of time travel in apps that use epics 15 | -------------------------------------------------------------------------------- /example/counter/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .atom/ 3 | .idea 4 | .packages 5 | .pub/ 6 | build/ 7 | ios/.generated/ 8 | packages 9 | pubspec.lock 10 | .flutter-plugins 11 | -------------------------------------------------------------------------------- /example/counter/README.md: -------------------------------------------------------------------------------- 1 | # counter 2 | 3 | Redux version of the Flutter counter app. 4 | 5 | This is a copy of the example program from [flutter_redux](https://github.com/brianegan/flutter_redux), with additional support for Remote Devtools. 6 | 7 | - Uses DevToolsStore to allow time travel 8 | - Connects to remote devtools on startup 9 | - Sends all actions and state updates 10 | 11 | ## Trying it out 12 | 13 | 1. Get [remotedev-server](https://github.com/zalmoxisus/remotedev-server) from npm: 14 | 15 | npm install -g remotedev-server 16 | 17 | 2. Start the server 18 | 19 | remotedev --port 8000 20 | 21 | 3. Edit `main.dart` and put in your computer's IP address or host name 22 | 23 | 4. Open `http://localhost:8000` in a web browser. You should see the remote-devtools window 24 | 25 | 5. Run the flutter app 26 | 27 | flutter packages get 28 | flutter run 29 | 30 | 6. Hit that button, increment the counter, see the actions fly through 31 | 32 | 7. Use the time travel slider to move back and forth through state changes! 33 | -------------------------------------------------------------------------------- /example/counter/android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | GeneratedPluginRegistrant.java 10 | -------------------------------------------------------------------------------- /example/counter/android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | android 4 | Project android created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | -------------------------------------------------------------------------------- /example/counter/android/app/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /example/counter/android/app/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | app 4 | Project app created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.buildship.core.gradleprojectnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /example/counter/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withInputStream { stream -> 5 | localProperties.load(stream) 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 | apply plugin: 'com.android.application' 15 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 16 | 17 | android { 18 | compileSdkVersion 25 19 | buildToolsVersion '25.0.3' 20 | 21 | lintOptions { 22 | disable 'InvalidPackage' 23 | } 24 | 25 | defaultConfig { 26 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 27 | applicationId "com.yourcompany.example" 28 | minSdkVersion 16 29 | targetSdkVersion 25 30 | versionCode 1 31 | versionName "1.0" 32 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 33 | } 34 | 35 | buildTypes { 36 | release { 37 | // TODO: Add your own signing config for the release build. 38 | // Signing with the debug keys for now, so `flutter run --release` works. 39 | signingConfig signingConfigs.debug 40 | } 41 | } 42 | } 43 | 44 | flutter { 45 | source '../..' 46 | } 47 | 48 | dependencies { 49 | androidTestCompile 'com.android.support:support-annotations:25.4.0' 50 | androidTestCompile 'com.android.support.test:runner:0.5' 51 | androidTestCompile 'com.android.support.test:rules:0.5' 52 | } 53 | -------------------------------------------------------------------------------- /example/counter/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 15 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /example/counter/android/app/src/main/java/com/yourcompany/example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.yourcompany.example; 2 | 3 | import android.os.Bundle; 4 | 5 | import io.flutter.app.FlutterActivity; 6 | import io.flutter.plugins.GeneratedPluginRegistrant; 7 | 8 | public class MainActivity extends FlutterActivity { 9 | @Override 10 | protected void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | GeneratedPluginRegistrant.registerWith(this); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /example/counter/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/counter/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/counter/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/counter/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/counter/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/counter/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/counter/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/counter/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | maven { 5 | url "https://maven.google.com" 6 | } 7 | } 8 | 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:2.3.3' 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | jcenter() 17 | maven { 18 | url "https://maven.google.com" 19 | } 20 | } 21 | } 22 | 23 | rootProject.buildDir = '../build' 24 | subprojects { 25 | project.buildDir = "${rootProject.buildDir}/${project.name}" 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/counter/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /example/counter/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/counter/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-3.3-all.zip 7 | -------------------------------------------------------------------------------- /example/counter/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /example/counter/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /example/counter/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.withInputStream { stream -> plugins.load(stream) } 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 | -------------------------------------------------------------------------------- /example/counter/ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | *.pbxuser 16 | *.mode1v3 17 | *.mode2v3 18 | *.perspectivev3 19 | 20 | !default.pbxuser 21 | !default.mode1v3 22 | !default.mode2v3 23 | !default.perspectivev3 24 | 25 | xcuserdata 26 | 27 | *.moved-aside 28 | 29 | *.pyc 30 | *sync/ 31 | Icon? 32 | .tags* 33 | 34 | /Flutter/app.flx 35 | /Flutter/app.zip 36 | /Flutter/App.framework 37 | /Flutter/Flutter.framework 38 | /Flutter/Generated.xcconfig 39 | /ServiceDefinitions.json 40 | 41 | Pods/ 42 | -------------------------------------------------------------------------------- /example/counter/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 | UIRequiredDeviceCapabilities 24 | 25 | arm64 26 | 27 | MinimumOSVersion 28 | 8.0 29 | 30 | 31 | -------------------------------------------------------------------------------- /example/counter/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/counter/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/counter/ios/Flutter/flutter_assets/AssetManifest.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /example/counter/ios/Flutter/flutter_assets/FontManifest.json: -------------------------------------------------------------------------------- 1 | [{"fonts":[{"asset":"fonts/MaterialIcons-Regular.ttf"}],"family":"MaterialIcons"}] -------------------------------------------------------------------------------- /example/counter/ios/Flutter/flutter_assets/fonts/MaterialIcons-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Flutter/flutter_assets/fonts/MaterialIcons-Regular.ttf -------------------------------------------------------------------------------- /example/counter/ios/Flutter/flutter_assets/isolate_snapshot_data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Flutter/flutter_assets/isolate_snapshot_data -------------------------------------------------------------------------------- /example/counter/ios/Flutter/flutter_assets/kernel_blob.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Flutter/flutter_assets/kernel_blob.bin -------------------------------------------------------------------------------- /example/counter/ios/Flutter/flutter_assets/platform_strong.dill: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Flutter/flutter_assets/platform_strong.dill -------------------------------------------------------------------------------- /example/counter/ios/Flutter/flutter_assets/vm_snapshot_data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Flutter/flutter_assets/vm_snapshot_data -------------------------------------------------------------------------------- /example/counter/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 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 13 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; }; 14 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 15 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 16 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 17 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 18 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXCopyFilesBuildPhase section */ 22 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 23 | isa = PBXCopyFilesBuildPhase; 24 | buildActionMask = 2147483647; 25 | dstPath = ""; 26 | dstSubfolderSpec = 10; 27 | files = ( 28 | ); 29 | name = "Embed Frameworks"; 30 | runOnlyForDeploymentPostprocessing = 0; 31 | }; 32 | /* End PBXCopyFilesBuildPhase section */ 33 | 34 | /* Begin PBXFileReference section */ 35 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 36 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 37 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 38 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 39 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 40 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 41 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 42 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 43 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 45 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 46 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 47 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 48 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | /* End PBXFileReference section */ 50 | 51 | /* Begin PBXFrameworksBuildPhase section */ 52 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 53 | isa = PBXFrameworksBuildPhase; 54 | buildActionMask = 2147483647; 55 | files = ( 56 | ); 57 | runOnlyForDeploymentPostprocessing = 0; 58 | }; 59 | /* End PBXFrameworksBuildPhase section */ 60 | 61 | /* Begin PBXGroup section */ 62 | 9740EEB11CF90186004384FC /* Flutter */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 66 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 67 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 68 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 69 | ); 70 | name = Flutter; 71 | sourceTree = ""; 72 | }; 73 | 97C146E51CF9000F007C117D = { 74 | isa = PBXGroup; 75 | children = ( 76 | 9740EEB11CF90186004384FC /* Flutter */, 77 | 97C146F01CF9000F007C117D /* Runner */, 78 | 97C146EF1CF9000F007C117D /* Products */, 79 | ); 80 | sourceTree = ""; 81 | }; 82 | 97C146EF1CF9000F007C117D /* Products */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 97C146EE1CF9000F007C117D /* Runner.app */, 86 | ); 87 | name = Products; 88 | sourceTree = ""; 89 | }; 90 | 97C146F01CF9000F007C117D /* Runner */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 94 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 95 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 96 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 98 | 97C147021CF9000F007C117D /* Info.plist */, 99 | 97C146F11CF9000F007C117D /* Supporting Files */, 100 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 101 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 102 | ); 103 | path = Runner; 104 | sourceTree = ""; 105 | }; 106 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 97C146F21CF9000F007C117D /* main.m */, 110 | ); 111 | name = "Supporting Files"; 112 | sourceTree = ""; 113 | }; 114 | /* End PBXGroup section */ 115 | 116 | /* Begin PBXNativeTarget section */ 117 | 97C146ED1CF9000F007C117D /* Runner */ = { 118 | isa = PBXNativeTarget; 119 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 120 | buildPhases = ( 121 | 9740EEB61CF901F6004384FC /* Run Script */, 122 | 97C146EA1CF9000F007C117D /* Sources */, 123 | 97C146EB1CF9000F007C117D /* Frameworks */, 124 | 97C146EC1CF9000F007C117D /* Resources */, 125 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 126 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 127 | ); 128 | buildRules = ( 129 | ); 130 | dependencies = ( 131 | ); 132 | name = Runner; 133 | productName = Runner; 134 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 135 | productType = "com.apple.product-type.application"; 136 | }; 137 | /* End PBXNativeTarget section */ 138 | 139 | /* Begin PBXProject section */ 140 | 97C146E61CF9000F007C117D /* Project object */ = { 141 | isa = PBXProject; 142 | attributes = { 143 | LastUpgradeCheck = 0830; 144 | ORGANIZATIONNAME = "The Chromium Authors"; 145 | TargetAttributes = { 146 | 97C146ED1CF9000F007C117D = { 147 | CreatedOnToolsVersion = 7.3.1; 148 | }; 149 | }; 150 | }; 151 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 152 | compatibilityVersion = "Xcode 3.2"; 153 | developmentRegion = English; 154 | hasScannedForEncodings = 0; 155 | knownRegions = ( 156 | English, 157 | en, 158 | Base, 159 | ); 160 | mainGroup = 97C146E51CF9000F007C117D; 161 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 162 | projectDirPath = ""; 163 | projectRoot = ""; 164 | targets = ( 165 | 97C146ED1CF9000F007C117D /* Runner */, 166 | ); 167 | }; 168 | /* End PBXProject section */ 169 | 170 | /* Begin PBXResourcesBuildPhase section */ 171 | 97C146EC1CF9000F007C117D /* Resources */ = { 172 | isa = PBXResourcesBuildPhase; 173 | buildActionMask = 2147483647; 174 | files = ( 175 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 176 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */, 177 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 178 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 179 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 180 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | }; 184 | /* End PBXResourcesBuildPhase section */ 185 | 186 | /* Begin PBXShellScriptBuildPhase section */ 187 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 188 | isa = PBXShellScriptBuildPhase; 189 | buildActionMask = 2147483647; 190 | files = ( 191 | ); 192 | inputPaths = ( 193 | ); 194 | name = "Thin Binary"; 195 | outputPaths = ( 196 | ); 197 | runOnlyForDeploymentPostprocessing = 0; 198 | shellPath = /bin/sh; 199 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 200 | }; 201 | 9740EEB61CF901F6004384FC /* Run Script */ = { 202 | isa = PBXShellScriptBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | ); 206 | inputPaths = ( 207 | ); 208 | name = "Run Script"; 209 | outputPaths = ( 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | shellPath = /bin/sh; 213 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 214 | }; 215 | /* End PBXShellScriptBuildPhase section */ 216 | 217 | /* Begin PBXSourcesBuildPhase section */ 218 | 97C146EA1CF9000F007C117D /* Sources */ = { 219 | isa = PBXSourcesBuildPhase; 220 | buildActionMask = 2147483647; 221 | files = ( 222 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 223 | 97C146F31CF9000F007C117D /* main.m in Sources */, 224 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | /* End PBXSourcesBuildPhase section */ 229 | 230 | /* Begin PBXVariantGroup section */ 231 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 232 | isa = PBXVariantGroup; 233 | children = ( 234 | 97C146FB1CF9000F007C117D /* Base */, 235 | ); 236 | name = Main.storyboard; 237 | sourceTree = ""; 238 | }; 239 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 240 | isa = PBXVariantGroup; 241 | children = ( 242 | 97C147001CF9000F007C117D /* Base */, 243 | ); 244 | name = LaunchScreen.storyboard; 245 | sourceTree = ""; 246 | }; 247 | /* End PBXVariantGroup section */ 248 | 249 | /* Begin XCBuildConfiguration section */ 250 | 97C147031CF9000F007C117D /* Debug */ = { 251 | isa = XCBuildConfiguration; 252 | buildSettings = { 253 | ALWAYS_SEARCH_USER_PATHS = NO; 254 | CLANG_ANALYZER_NONNULL = YES; 255 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 256 | CLANG_CXX_LIBRARY = "libc++"; 257 | CLANG_ENABLE_MODULES = YES; 258 | CLANG_ENABLE_OBJC_ARC = YES; 259 | CLANG_WARN_BOOL_CONVERSION = YES; 260 | CLANG_WARN_CONSTANT_CONVERSION = YES; 261 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 262 | CLANG_WARN_EMPTY_BODY = YES; 263 | CLANG_WARN_ENUM_CONVERSION = YES; 264 | CLANG_WARN_INFINITE_RECURSION = YES; 265 | CLANG_WARN_INT_CONVERSION = YES; 266 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 267 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 268 | CLANG_WARN_UNREACHABLE_CODE = YES; 269 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 270 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 271 | COPY_PHASE_STRIP = NO; 272 | DEBUG_INFORMATION_FORMAT = dwarf; 273 | ENABLE_STRICT_OBJC_MSGSEND = YES; 274 | ENABLE_TESTABILITY = YES; 275 | GCC_C_LANGUAGE_STANDARD = gnu99; 276 | GCC_DYNAMIC_NO_PIC = NO; 277 | GCC_NO_COMMON_BLOCKS = YES; 278 | GCC_OPTIMIZATION_LEVEL = 0; 279 | GCC_PREPROCESSOR_DEFINITIONS = ( 280 | "DEBUG=1", 281 | "$(inherited)", 282 | ); 283 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 284 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 285 | GCC_WARN_UNDECLARED_SELECTOR = YES; 286 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 287 | GCC_WARN_UNUSED_FUNCTION = YES; 288 | GCC_WARN_UNUSED_VARIABLE = YES; 289 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 290 | MTL_ENABLE_DEBUG_INFO = YES; 291 | ONLY_ACTIVE_ARCH = YES; 292 | SDKROOT = iphoneos; 293 | TARGETED_DEVICE_FAMILY = "1,2"; 294 | }; 295 | name = Debug; 296 | }; 297 | 97C147041CF9000F007C117D /* Release */ = { 298 | isa = XCBuildConfiguration; 299 | buildSettings = { 300 | ALWAYS_SEARCH_USER_PATHS = NO; 301 | CLANG_ANALYZER_NONNULL = YES; 302 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 303 | CLANG_CXX_LIBRARY = "libc++"; 304 | CLANG_ENABLE_MODULES = YES; 305 | CLANG_ENABLE_OBJC_ARC = YES; 306 | CLANG_WARN_BOOL_CONVERSION = YES; 307 | CLANG_WARN_CONSTANT_CONVERSION = YES; 308 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 309 | CLANG_WARN_EMPTY_BODY = YES; 310 | CLANG_WARN_ENUM_CONVERSION = YES; 311 | CLANG_WARN_INFINITE_RECURSION = YES; 312 | CLANG_WARN_INT_CONVERSION = YES; 313 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 314 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 315 | CLANG_WARN_UNREACHABLE_CODE = YES; 316 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 317 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 318 | COPY_PHASE_STRIP = NO; 319 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 320 | ENABLE_NS_ASSERTIONS = NO; 321 | ENABLE_STRICT_OBJC_MSGSEND = YES; 322 | GCC_C_LANGUAGE_STANDARD = gnu99; 323 | GCC_NO_COMMON_BLOCKS = YES; 324 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 325 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 326 | GCC_WARN_UNDECLARED_SELECTOR = YES; 327 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 328 | GCC_WARN_UNUSED_FUNCTION = YES; 329 | GCC_WARN_UNUSED_VARIABLE = YES; 330 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 331 | MTL_ENABLE_DEBUG_INFO = NO; 332 | SDKROOT = iphoneos; 333 | TARGETED_DEVICE_FAMILY = "1,2"; 334 | VALIDATE_PRODUCT = YES; 335 | }; 336 | name = Release; 337 | }; 338 | 97C147061CF9000F007C117D /* Debug */ = { 339 | isa = XCBuildConfiguration; 340 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 341 | buildSettings = { 342 | ARCHS = arm64; 343 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 344 | ENABLE_BITCODE = NO; 345 | FRAMEWORK_SEARCH_PATHS = ( 346 | "$(inherited)", 347 | "$(PROJECT_DIR)/Flutter", 348 | ); 349 | INFOPLIST_FILE = Runner/Info.plist; 350 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 351 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 352 | LIBRARY_SEARCH_PATHS = ( 353 | "$(inherited)", 354 | "$(PROJECT_DIR)/Flutter", 355 | ); 356 | PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.example; 357 | PRODUCT_NAME = "$(TARGET_NAME)"; 358 | }; 359 | name = Debug; 360 | }; 361 | 97C147071CF9000F007C117D /* Release */ = { 362 | isa = XCBuildConfiguration; 363 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 364 | buildSettings = { 365 | ARCHS = arm64; 366 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 367 | ENABLE_BITCODE = NO; 368 | FRAMEWORK_SEARCH_PATHS = ( 369 | "$(inherited)", 370 | "$(PROJECT_DIR)/Flutter", 371 | ); 372 | INFOPLIST_FILE = Runner/Info.plist; 373 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 374 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 375 | LIBRARY_SEARCH_PATHS = ( 376 | "$(inherited)", 377 | "$(PROJECT_DIR)/Flutter", 378 | ); 379 | PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.example; 380 | PRODUCT_NAME = "$(TARGET_NAME)"; 381 | }; 382 | name = Release; 383 | }; 384 | /* End XCBuildConfiguration section */ 385 | 386 | /* Begin XCConfigurationList section */ 387 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 388 | isa = XCConfigurationList; 389 | buildConfigurations = ( 390 | 97C147031CF9000F007C117D /* Debug */, 391 | 97C147041CF9000F007C117D /* Release */, 392 | ); 393 | defaultConfigurationIsVisible = 0; 394 | defaultConfigurationName = Release; 395 | }; 396 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 397 | isa = XCConfigurationList; 398 | buildConfigurations = ( 399 | 97C147061CF9000F007C117D /* Debug */, 400 | 97C147071CF9000F007C117D /* Release */, 401 | ); 402 | defaultConfigurationIsVisible = 0; 403 | defaultConfigurationName = Release; 404 | }; 405 | /* End XCConfigurationList section */ 406 | }; 407 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 408 | } 409 | -------------------------------------------------------------------------------- /example/counter/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/counter/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /example/counter/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/counter/ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /example/counter/ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 7 | [GeneratedPluginRegistrant registerWithRegistry:self]; 8 | // Override point for customization after application launch. 9 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 10 | } 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /example/counter/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 | "info" : { 113 | "version" : 1, 114 | "author" : "xcode" 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/counter/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 | -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/counter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/counter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/counter/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. -------------------------------------------------------------------------------- /example/counter/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 | -------------------------------------------------------------------------------- /example/counter/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 | -------------------------------------------------------------------------------- /example/counter/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSAppTransportSecurity 6 | 7 | NSAllowsArbitraryLoads 8 | 9 | NSAllowsLocalNetworking 10 | 11 | 12 | CFBundleDevelopmentRegion 13 | en 14 | CFBundleExecutable 15 | $(EXECUTABLE_NAME) 16 | CFBundleIdentifier 17 | $(PRODUCT_BUNDLE_IDENTIFIER) 18 | CFBundleInfoDictionaryVersion 19 | 6.0 20 | CFBundleName 21 | example 22 | CFBundlePackageType 23 | APPL 24 | CFBundleShortVersionString 25 | 1.0 26 | CFBundleSignature 27 | ???? 28 | CFBundleVersion 29 | 1 30 | LSRequiresIPhoneOS 31 | 32 | UILaunchStoryboardName 33 | LaunchScreen 34 | UIMainStoryboardFile 35 | Main 36 | UIRequiredDeviceCapabilities 37 | 38 | arm64 39 | 40 | UISupportedInterfaceOrientations 41 | 42 | UIInterfaceOrientationPortrait 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | UISupportedInterfaceOrientations~ipad 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationPortraitUpsideDown 50 | UIInterfaceOrientationLandscapeLeft 51 | UIInterfaceOrientationLandscapeRight 52 | 53 | UIViewControllerBasedStatusBarAppearance 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /example/counter/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 | -------------------------------------------------------------------------------- /example/counter/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:redux_dev_tools/redux_dev_tools.dart'; 3 | import 'package:flutter_redux/flutter_redux.dart'; 4 | import 'package:redux/redux.dart'; 5 | import 'package:redux_remote_devtools/redux_remote_devtools.dart'; 6 | 7 | // One simple action: Increment 8 | enum Actions { Increment } 9 | 10 | // The reducer, which takes the previous count and increments it in response 11 | // to an Increment action. 12 | int counterReducer(int state, dynamic action) { 13 | if (action == Actions.Increment) { 14 | return state + 1; 15 | } 16 | 17 | return state; 18 | } 19 | 20 | void main() async { 21 | // Create your store as a final variable in a base Widget. This works better 22 | // with Hot Reload than creating it directly in the `build` function. 23 | 24 | var remoteDevtools = RemoteDevToolsMiddleware('192.168.1.52:8000'); 25 | await remoteDevtools.connect(); 26 | final store = DevToolsStore(counterReducer, 27 | initialState: 0, middleware: [remoteDevtools]); 28 | 29 | remoteDevtools.store = store; 30 | 31 | runApp(new FlutterReduxApp( 32 | title: 'Flutter Redux Demo', 33 | store: store, 34 | )); 35 | } 36 | 37 | class FlutterReduxApp extends StatelessWidget { 38 | final Store store; 39 | final String title; 40 | 41 | FlutterReduxApp({Key? key, required this.store, required this.title}) 42 | : super(key: key); 43 | 44 | @override 45 | Widget build(BuildContext context) { 46 | // The StoreProvider should wrap your MaterialApp or WidgetsApp. This will 47 | // ensure all routes have access to the store. 48 | return new StoreProvider( 49 | // Pass the store to the StoreProvider. Any ancestor `StoreConnector` 50 | // Widgets will find and use this value as the `Store`. 51 | store: store, 52 | child: new MaterialApp( 53 | theme: new ThemeData.dark(), 54 | title: title, 55 | home: new Scaffold( 56 | appBar: new AppBar( 57 | title: new Text(title), 58 | ), 59 | body: new Center( 60 | child: new Column( 61 | mainAxisAlignment: MainAxisAlignment.center, 62 | children: [ 63 | new Text( 64 | 'You have pushed the button this many times:', 65 | ), 66 | // Connect the Store to a Text Widget that renders the current 67 | // count. 68 | // 69 | // We'll wrap the Text Widget in a `StoreConnector` Widget. The 70 | // `StoreConnector` will find the `Store` from the nearest 71 | // `StoreProvider` ancestor, convert it into a String of the 72 | // latest count, and pass that String to the `builder` function 73 | // as the `count`. 74 | // 75 | // Every time the button is tapped, an action is dispatched and 76 | // run through the reducer. After the reducer updates the state, 77 | // the Widget will be automatically rebuilt with the latest 78 | // count. No need to manually manage subscriptions or Streams! 79 | new StoreConnector( 80 | converter: (store) => store.state.toString(), 81 | builder: (context, count) { 82 | return new Text( 83 | count, 84 | style: Theme.of(context).textTheme.headline4, 85 | ); 86 | }, 87 | ) 88 | ], 89 | ), 90 | ), 91 | // Connect the Store to a FloatingActionButton. In this case, we'll 92 | // use the Store to build a callback that with dispatch an Increment 93 | // Action. 94 | // 95 | // Then, we'll pass this callback to the button's `onPressed` handler. 96 | floatingActionButton: new StoreConnector( 97 | converter: (store) { 98 | // Return a `VoidCallback`, which is a fancy name for a function 99 | // with no parameters. It only dispatches an Increment action. 100 | return () => store.dispatch(Actions.Increment); 101 | }, 102 | builder: (context, callback) { 103 | return new FloatingActionButton( 104 | // Attach the `callback` to the `onPressed` attribute 105 | onPressed: callback, 106 | tooltip: 'asdasdasd', 107 | child: new Icon(Icons.add), 108 | ); 109 | }, 110 | ), 111 | ), 112 | ), 113 | ); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /example/counter/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: Flutter counter using redux. 3 | publish_to: none 4 | 5 | version: 1.0.0+1 6 | 7 | environment: 8 | sdk: ">=2.12.0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | flutter_redux: ^0.8.2 14 | redux_dev_tools: 15 | git: 16 | url: https://github.com/MichaelMarner/redux_dev_tools.git 17 | ref: null-safety 18 | redux_remote_devtools: 19 | path: ../../ 20 | 21 | # The following adds the Cupertino Icons font to your application. 22 | # Use with the CupertinoIcons class for iOS style icons. 23 | cupertino_icons: ^1.0.2 24 | 25 | dev_dependencies: 26 | flutter_test: 27 | sdk: flutter 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 | # The following line ensures that the Material Icons font is 35 | # included with your application, so that you can use the icons in 36 | # the material Icons class. 37 | uses-material-design: true 38 | # To add assets to your application, add an assets section, like this: 39 | # assets: 40 | # - images/a_dot_burr.jpeg 41 | # - images/a_dot_ham.jpeg 42 | # An image asset can refer to one or more resolution-specific "variants", see 43 | # https://flutter.io/assets-and-images/#resolution-aware. 44 | # For details regarding adding assets from package dependencies, see 45 | # https://flutter.io/assets-and-images/#from-packages 46 | # To add custom fonts to your application, add a fonts section here, 47 | # in this "flutter" section. Each entry in this list should have a 48 | # "family" key with the font family name, and a "fonts" key with a 49 | # list giving the asset and other descriptors for the font. For 50 | # example: 51 | # fonts: 52 | # - family: Schyler 53 | # fonts: 54 | # - asset: fonts/Schyler-Regular.ttf 55 | # - asset: fonts/Schyler-Italic.ttf 56 | # style: italic 57 | # - family: Trajan Pro 58 | # fonts: 59 | # - asset: fonts/TrajanPro.ttf 60 | # - asset: fonts/TrajanPro_Bold.ttf 61 | # weight: 700 62 | # 63 | # For details regarding fonts from package dependencies, 64 | # see https://flutter.io/custom-fonts/#from-packages 65 | -------------------------------------------------------------------------------- /example/githubsearch/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | 9 | .flutter-plugins 10 | -------------------------------------------------------------------------------- /example/githubsearch/.idea/libraries/Dart_SDK.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /example/githubsearch/.idea/libraries/Flutter_for_Android.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /example/githubsearch/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /example/githubsearch/.idea/runConfigurations/main_dart.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /example/githubsearch/.idea/workspace.xml: -------------------------------------------------------------------------------- 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 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /example/githubsearch/.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: 5ab9e70727d858def3a586db7fb98ee580352957 8 | channel: beta 9 | -------------------------------------------------------------------------------- /example/githubsearch/README.md: -------------------------------------------------------------------------------- 1 | # githubsearch 2 | 3 | Redux demonstration app that lets you search Github repositories. 4 | 5 | This is a copy of the example program from [flutter_redux](https://github.com/brianegan/flutter_redux), with additional support for Remote Devtools. 6 | 7 | - Uses DevToolsStore to allow time travel 8 | - Connects to remote devtools on startup 9 | - Sends all actions and state updates serialized as JSON 10 | 11 | ## Trying it out 12 | 13 | 1. Get [remotedev-server](https://github.com/zalmoxisus/remotedev-server) from npm: 14 | 15 | npm install -g remotedev-server 16 | 17 | 2. Start the server 18 | 19 | remotedev --port 8000 20 | 21 | 3. Edit `main.dart` and put in your computer's IP address or host name 22 | 23 | 4. Open `http://localhost:8000` in a web browser. You should see the remote-devtools window 24 | 25 | 5. Run the flutter app 26 | 27 | flutter packages get 28 | flutter run 29 | 30 | 6. Search repos, see the actions fly through devtools 31 | -------------------------------------------------------------------------------- /example/githubsearch/android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | *.class 3 | .gradle 4 | /local.properties 5 | /.idea/workspace.xml 6 | /.idea/libraries 7 | .DS_Store 8 | /build 9 | /captures 10 | GeneratedPluginRegistrant.java 11 | -------------------------------------------------------------------------------- /example/githubsearch/android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | android 4 | Project android created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | -------------------------------------------------------------------------------- /example/githubsearch/android/app/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /example/githubsearch/android/app/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | app 4 | Project app created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.buildship.core.gradleprojectnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /example/githubsearch/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.example.githubsearch" 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 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 61 | } 62 | -------------------------------------------------------------------------------- /example/githubsearch/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 15 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /example/githubsearch/android/app/src/main/java/com/example/githubsearch/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.githubsearch; 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 | -------------------------------------------------------------------------------- /example/githubsearch/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/githubsearch/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/githubsearch/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/githubsearch/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/githubsearch/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/githubsearch/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/githubsearch/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/githubsearch/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.1.2' 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 | -------------------------------------------------------------------------------- /example/githubsearch/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /example/githubsearch/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/githubsearch/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.4-all.zip 7 | -------------------------------------------------------------------------------- /example/githubsearch/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /example/githubsearch/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /example/githubsearch/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 | -------------------------------------------------------------------------------- /example/githubsearch/githubsearch.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /example/githubsearch/githubsearch_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /example/githubsearch/ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/app.flx 37 | /Flutter/app.zip 38 | /Flutter/flutter_assets/ 39 | /Flutter/App.framework 40 | /Flutter/Flutter.framework 41 | /Flutter/Generated.xcconfig 42 | /ServiceDefinitions.json 43 | 44 | Pods/ 45 | .symlinks/ 46 | -------------------------------------------------------------------------------- /example/githubsearch/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 | -------------------------------------------------------------------------------- /example/githubsearch/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/githubsearch/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/githubsearch/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 | -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /example/githubsearch/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 | -------------------------------------------------------------------------------- /example/githubsearch/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 | -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/githubsearch/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 | -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichaelMarner/dart-redux-remote-devtools/8adc92eafae57769fcf75c0f4e0354c0a005f7a1/example/githubsearch/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/githubsearch/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. -------------------------------------------------------------------------------- /example/githubsearch/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 | -------------------------------------------------------------------------------- /example/githubsearch/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 | -------------------------------------------------------------------------------- /example/githubsearch/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSAppTransportSecurity 6 | 7 | NSAllowsArbitraryLoads 8 | 9 | NSAllowsLocalNetworking 10 | 11 | 12 | CFBundleDevelopmentRegion 13 | en 14 | CFBundleExecutable 15 | $(EXECUTABLE_NAME) 16 | CFBundleIdentifier 17 | $(PRODUCT_BUNDLE_IDENTIFIER) 18 | CFBundleInfoDictionaryVersion 19 | 6.0 20 | CFBundleName 21 | githubsearch 22 | CFBundlePackageType 23 | APPL 24 | CFBundleShortVersionString 25 | $(FLUTTER_BUILD_NAME) 26 | CFBundleSignature 27 | ???? 28 | CFBundleVersion 29 | $(FLUTTER_BUILD_NUMBER) 30 | LSRequiresIPhoneOS 31 | 32 | UILaunchStoryboardName 33 | LaunchScreen 34 | UIMainStoryboardFile 35 | Main 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UISupportedInterfaceOrientations~ipad 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationPortraitUpsideDown 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | UIViewControllerBasedStatusBarAppearance 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /example/githubsearch/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 | -------------------------------------------------------------------------------- /example/githubsearch/lib/SearchResult.dart: -------------------------------------------------------------------------------- 1 | import './github_search_api.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | part 'SearchResult.g.dart'; 5 | 6 | @JsonSerializable() 7 | class SearchResult { 8 | final SearchResultKind kind; 9 | final List items; 10 | 11 | SearchResult(this.kind, this.items); 12 | 13 | factory SearchResult.noTerm() => 14 | new SearchResult(SearchResultKind.noTerm, []); 15 | 16 | factory SearchResult.fromJson(dynamic json) { 17 | final items = (json as List) 18 | .cast>() 19 | .map((Map item) { 20 | return new SearchResultItem.fromJson(item); 21 | }).toList(); 22 | 23 | return new SearchResult( 24 | items.isEmpty ? SearchResultKind.empty : SearchResultKind.populated, 25 | items, 26 | ); 27 | } 28 | Map toJson() => _$SearchResultToJson(this); 29 | 30 | bool get isPopulated => kind == SearchResultKind.populated; 31 | 32 | bool get isEmpty => kind == SearchResultKind.empty; 33 | 34 | bool get isNoTerm => kind == SearchResultKind.noTerm; 35 | } 36 | -------------------------------------------------------------------------------- /example/githubsearch/lib/SearchResult.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'SearchResult.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SearchResult _$SearchResultFromJson(Map json) { 10 | return SearchResult( 11 | _$enumDecode(_$SearchResultKindEnumMap, json['kind']), 12 | (json['items'] as List) 13 | .map((e) => SearchResultItem.fromJson((e as Map).map( 14 | (k, e) => MapEntry(k, e as Object), 15 | ))) 16 | .toList(), 17 | ); 18 | } 19 | 20 | Map _$SearchResultToJson(SearchResult instance) => 21 | { 22 | 'kind': _$SearchResultKindEnumMap[instance.kind], 23 | 'items': instance.items, 24 | }; 25 | 26 | K _$enumDecode( 27 | Map enumValues, 28 | Object? source, { 29 | K? unknownValue, 30 | }) { 31 | if (source == null) { 32 | throw ArgumentError( 33 | 'A value must be provided. Supported values: ' 34 | '${enumValues.values.join(', ')}', 35 | ); 36 | } 37 | 38 | return enumValues.entries.singleWhere( 39 | (e) => e.value == source, 40 | orElse: () { 41 | if (unknownValue == null) { 42 | throw ArgumentError( 43 | '`$source` is not one of the supported values: ' 44 | '${enumValues.values.join(', ')}', 45 | ); 46 | } 47 | return MapEntry(unknownValue, enumValues.values.first); 48 | }, 49 | ).key; 50 | } 51 | 52 | const _$SearchResultKindEnumMap = { 53 | SearchResultKind.noTerm: 'noTerm', 54 | SearchResultKind.empty: 'empty', 55 | SearchResultKind.populated: 'populated', 56 | }; 57 | -------------------------------------------------------------------------------- /example/githubsearch/lib/SearchState.dart: -------------------------------------------------------------------------------- 1 | import './SearchResult.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | part 'SearchState.g.dart'; 5 | 6 | @JsonSerializable() 7 | class SearchState { 8 | final SearchResult? result; 9 | final bool hasError; 10 | final bool isLoading; 11 | 12 | SearchState({ 13 | this.result, 14 | this.hasError = false, 15 | this.isLoading = false, 16 | }); 17 | 18 | factory SearchState.initial() => SearchState(result: SearchResult.noTerm()); 19 | 20 | factory SearchState.loading() => SearchState(isLoading: true); 21 | 22 | factory SearchState.error() => SearchState(hasError: true); 23 | 24 | Map toJson() => _$SearchStateToJson(this); 25 | } 26 | -------------------------------------------------------------------------------- /example/githubsearch/lib/SearchState.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'SearchState.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SearchState _$SearchStateFromJson(Map json) { 10 | return SearchState( 11 | result: SearchResult.fromJson(json['result']), 12 | hasError: json['hasError'] as bool, 13 | isLoading: json['isLoading'] as bool, 14 | ); 15 | } 16 | 17 | Map _$SearchStateToJson(SearchState instance) => 18 | { 19 | 'result': instance.result, 20 | 'hasError': instance.hasError, 21 | 'isLoading': instance.isLoading, 22 | }; 23 | -------------------------------------------------------------------------------- /example/githubsearch/lib/empty_result_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class EmptyResultWidget extends StatelessWidget { 4 | final bool isEmpty; 5 | 6 | EmptyResultWidget(this.isEmpty); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return new AnimatedOpacity( 11 | duration: new Duration(milliseconds: 300), 12 | opacity: isEmpty ? 1.0 : 0.0, 13 | child: new Container( 14 | alignment: FractionalOffset.center, 15 | child: new Column( 16 | mainAxisAlignment: MainAxisAlignment.center, 17 | children: [ 18 | new Icon( 19 | Icons.warning, 20 | color: Colors.yellow[200], 21 | size: 80.0, 22 | ), 23 | new Container( 24 | padding: new EdgeInsets.only(top: 16.0), 25 | child: new Text( 26 | "No results", 27 | style: new TextStyle(color: Colors.yellow[100]), 28 | ), 29 | ) 30 | ], 31 | ), 32 | ), 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /example/githubsearch/lib/github_search_api.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | import 'dart:io'; 4 | import './SearchResult.dart'; 5 | 6 | class GithubApi { 7 | final String baseUrl; 8 | late final Map cache; 9 | late final HttpClient client; 10 | 11 | GithubApi({ 12 | HttpClient? client, 13 | Map? cache, 14 | this.baseUrl = "https://api.github.com/search/repositories?q=", 15 | }) : this.client = client ?? new HttpClient(), 16 | this.cache = cache ?? {}; 17 | 18 | /// Search Github for repositories using the given term 19 | Future search(String term) async { 20 | if (term.isEmpty) { 21 | return new SearchResult.noTerm(); 22 | } else if (cache.containsKey(term)) { 23 | return cache[term]!; 24 | } else { 25 | final result = await _fetchResults(term); 26 | 27 | cache[term] = result; 28 | 29 | return result; 30 | } 31 | } 32 | 33 | Future _fetchResults(String term) async { 34 | final request = await new HttpClient().getUrl(Uri.parse("$baseUrl$term")); 35 | final response = await request.close(); 36 | final results = json.decode(await utf8.decoder.bind(response).join()); 37 | 38 | return new SearchResult.fromJson(results['items']); 39 | } 40 | } 41 | 42 | enum SearchResultKind { noTerm, empty, populated } 43 | 44 | class SearchResultItem { 45 | final String fullName; 46 | final String url; 47 | final String avatarUrl; 48 | 49 | toJson() { 50 | return {'fullName': fullName, 'url': url, 'avatarUrl': avatarUrl}; 51 | } 52 | 53 | SearchResultItem(this.fullName, this.url, this.avatarUrl); 54 | 55 | factory SearchResultItem.fromJson(Map json) { 56 | return new SearchResultItem( 57 | json['full_name'] as String, 58 | json["html_url"] as String, 59 | (json["owner"] as Map)["avatar_url"] as String, 60 | ); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /example/githubsearch/lib/github_search_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_redux/flutter_redux.dart'; 3 | import 'empty_result_widget.dart'; 4 | import 'redux.dart'; 5 | import 'search_error_widget.dart'; 6 | import 'search_intro_widget.dart'; 7 | import 'search_loading_widget.dart'; 8 | import 'search_result_widget.dart'; 9 | import './SearchState.dart'; 10 | 11 | class SearchScreen extends StatelessWidget { 12 | SearchScreen({Key? key}) : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return new StoreConnector( 17 | converter: (store) { 18 | return SearchScreenViewModel( 19 | state: store.state, 20 | onTextChanged: (term) => store.dispatch(SearchAction(term)), 21 | ); 22 | }, 23 | builder: (BuildContext context, SearchScreenViewModel vm) { 24 | return new Scaffold( 25 | body: new Stack( 26 | children: [ 27 | new Flex(direction: Axis.vertical, children: [ 28 | new Container( 29 | padding: new EdgeInsets.fromLTRB(16.0, 24.0, 16.0, 4.0), 30 | child: new TextField( 31 | decoration: new InputDecoration( 32 | border: InputBorder.none, 33 | hintText: 'Search Github...', 34 | ), 35 | style: new TextStyle( 36 | fontSize: 36.0, 37 | fontFamily: "Hind", 38 | decoration: TextDecoration.none, 39 | ), 40 | onChanged: vm.onTextChanged, 41 | ), 42 | ), 43 | new Expanded( 44 | child: new Stack( 45 | children: [ 46 | // Fade in an intro screen if no term has been entered 47 | new SearchIntroWidget(vm.state.result?.isNoTerm ?? false), 48 | 49 | // Fade in an Empty Result screen if the search contained 50 | // no items 51 | new EmptyResultWidget(vm.state.result?.isEmpty ?? false), 52 | 53 | // Fade in a loading screen when results are being fetched 54 | // from Github 55 | new SearchLoadingWidget(vm.state.isLoading ?? false), 56 | 57 | // Fade in an error if something went wrong when fetching 58 | // the results 59 | new SearchErrorWidget(vm.state.hasError ?? false), 60 | 61 | // Fade in the Result if available 62 | new SearchResultWidget(vm.state.result), 63 | ], 64 | ), 65 | ) 66 | ]) 67 | ], 68 | ), 69 | ); 70 | }, 71 | ); 72 | } 73 | } 74 | 75 | class SearchScreenViewModel { 76 | final SearchState state; 77 | final void Function(String term) onTextChanged; 78 | 79 | SearchScreenViewModel({required this.state, required this.onTextChanged}); 80 | } 81 | -------------------------------------------------------------------------------- /example/githubsearch/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_redux/flutter_redux.dart'; 3 | import 'github_search_api.dart'; 4 | import 'github_search_widget.dart'; 5 | import 'redux.dart'; 6 | import 'package:redux/redux.dart'; 7 | import 'package:redux_epics/redux_epics.dart'; 8 | import 'package:redux_dev_tools/redux_dev_tools.dart'; 9 | import 'package:redux_remote_devtools/redux_remote_devtools.dart'; 10 | import './SearchState.dart'; 11 | 12 | const REMOTE_HOST = '192.168.1.52:8000'; 13 | 14 | void main() async { 15 | var remoteDevtools = RemoteDevToolsMiddleware(REMOTE_HOST); 16 | await remoteDevtools.connect(); 17 | final store = new DevToolsStore(searchReducer, 18 | initialState: SearchState.initial(), 19 | middleware: [ 20 | remoteDevtools, 21 | EpicMiddleware(SearchEpic(GithubApi())), 22 | ]); 23 | 24 | remoteDevtools.store = store; 25 | 26 | remoteDevtools.connect(); 27 | 28 | runApp(new RxDartGithubSearchApp( 29 | store: store, 30 | )); 31 | } 32 | 33 | class RxDartGithubSearchApp extends StatelessWidget { 34 | final Store store; 35 | 36 | RxDartGithubSearchApp({Key key, this.store}) : super(key: key); 37 | 38 | @override 39 | Widget build(BuildContext context) { 40 | return new StoreProvider( 41 | store: store, 42 | child: new MaterialApp( 43 | title: 'RxDart Github Search', 44 | theme: new ThemeData( 45 | brightness: Brightness.dark, 46 | primarySwatch: Colors.grey, 47 | ), 48 | home: new SearchScreen(), 49 | ), 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /example/githubsearch/lib/redux.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'github_search_api.dart'; 3 | 4 | import 'package:async/async.dart'; 5 | import 'package:redux/redux.dart'; 6 | import 'package:redux_epics/redux_epics.dart'; 7 | import 'package:rxdart/rxdart.dart'; 8 | 9 | import './SearchState.dart'; 10 | import './SearchResult.dart'; 11 | 12 | // The State represents the data the View requires. The View consumes a Stream 13 | // of States. The view rebuilds every time the Stream emits a new State! 14 | // 15 | // The State Stream will emit new States depending on the situation: The 16 | // initial state, loading states, the list of results, and any errors that 17 | // happen. 18 | // 19 | // The State Stream responds to input from the View by accepting a 20 | // Stream. We call this Stream the onTextChanged "intent". 21 | 22 | /// Actions 23 | class SearchAction { 24 | final String term; 25 | 26 | SearchAction(this.term); 27 | 28 | toJson() { 29 | return {'term': term}; 30 | } 31 | } 32 | 33 | class SearchLoadingAction {} 34 | 35 | class SearchErrorAction {} 36 | 37 | class SearchResultAction { 38 | final SearchResult result; 39 | 40 | toJson() { 41 | return {'result': result}; 42 | } 43 | 44 | SearchResultAction(this.result); 45 | } 46 | 47 | /// Reducer 48 | final searchReducer = combineReducers([ 49 | TypedReducer(_onLoad), 50 | TypedReducer(_onError), 51 | TypedReducer(_onResult), 52 | ]); 53 | 54 | SearchState _onLoad(SearchState state, SearchLoadingAction action) => 55 | SearchState.loading(); 56 | 57 | SearchState _onError(SearchState state, SearchErrorAction action) => 58 | SearchState.error(); 59 | 60 | SearchState _onResult(SearchState state, SearchResultAction action) => 61 | SearchState(result: action.result, isLoading: false); 62 | 63 | /// The Search Middleware will listen for Search Actions and perform the search 64 | /// after the user stop typing for 250ms. 65 | /// 66 | /// If a previous search was still loading, we will cancel the operation and 67 | /// fetch a new set of results. This ensures only results for the latest search 68 | /// term are shown. 69 | class SearchMiddleware implements MiddlewareClass { 70 | final GithubApi api; 71 | 72 | Timer? _timer; 73 | CancelableOperation>? _operation; 74 | 75 | SearchMiddleware(this.api); 76 | 77 | @override 78 | void call(Store store, dynamic action, NextDispatcher next) { 79 | if (action is SearchAction) { 80 | // Stop our previous debounce timer and search. 81 | _timer?.cancel(); 82 | _operation?.cancel(); 83 | 84 | // Don't start searching until the user pauses for 250ms. This will stop 85 | // us from over-fetching from our backend. 86 | _timer = Timer(Duration(milliseconds: 250), () { 87 | store.dispatch(SearchLoadingAction()); 88 | 89 | // Instead of a simple Future, we'll use a CancellableOperation from the 90 | // `async` package. This will allow us to cancel the previous operation 91 | // if a new Search term comes in. This will prevent us from 92 | // accidentally showing stale results. 93 | _operation = CancelableOperation.fromFuture(api 94 | .search(action.term) 95 | .then((result) => store..dispatch(SearchResultAction(result))) 96 | .catchError((e, s) => store..dispatch(SearchErrorAction()))); 97 | }); 98 | } 99 | 100 | // Make sure to forward actions to the next middleware in the chain! 101 | next(action); 102 | } 103 | } 104 | 105 | /// The Search Epic provides the same functionality as the Search Middleware, 106 | /// but uses redux_epics and the RxDart package to perform the work. It will 107 | /// listen for Search Actions and perform the search after the user stop typing 108 | /// for 250ms. 109 | /// 110 | /// If a previous search was still loading, we will cancel the operation and 111 | /// fetch a new set of results. This ensures only results for the latest search 112 | /// term are shown. 113 | class SearchEpic implements EpicClass { 114 | final GithubApi api; 115 | 116 | SearchEpic(this.api); 117 | 118 | @override 119 | Stream call(Stream actions, EpicStore store) { 120 | return actions 121 | // Narrow down to SearchAction actions 122 | .whereType() 123 | // Don't start searching until the user pauses for 250ms 124 | .debounceTime(Duration(milliseconds: 250)) 125 | // Cancel the previous search and start a new one with switchMap 126 | .switchMap((action) => _search(action.term)); 127 | } 128 | 129 | // Use the async* function to make our lives easier 130 | Stream _search(String term) async* { 131 | // Dispatch a SearchLoadingAction to show a loading spinner 132 | yield SearchLoadingAction(); 133 | 134 | try { 135 | // If the api call is successful, dispatch the results for display 136 | yield SearchResultAction(await api.search(term)); 137 | } catch (e) { 138 | // If the search call fails, dispatch an error so we can show it 139 | yield SearchErrorAction(); 140 | } 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /example/githubsearch/lib/search_error_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SearchErrorWidget extends StatelessWidget { 4 | final bool hasError; 5 | 6 | SearchErrorWidget(this.hasError); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return new AnimatedOpacity( 11 | duration: new Duration(milliseconds: 300), 12 | opacity: hasError ? 1.0 : 0.0, 13 | child: new Container( 14 | alignment: FractionalOffset.center, 15 | child: new Column( 16 | mainAxisAlignment: MainAxisAlignment.center, 17 | crossAxisAlignment: CrossAxisAlignment.center, 18 | children: [ 19 | new Icon(Icons.error_outline, color: Colors.red[300], size: 80.0), 20 | new Container( 21 | padding: new EdgeInsets.only(top: 16.0), 22 | child: new Text( 23 | "Rate limit exceeded", 24 | style: new TextStyle( 25 | color: Colors.red[300], 26 | ), 27 | ), 28 | ) 29 | ], 30 | ), 31 | ), 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /example/githubsearch/lib/search_intro_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SearchIntroWidget extends StatelessWidget { 4 | final bool isVisible; 5 | 6 | SearchIntroWidget(this.isVisible); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return new AnimatedOpacity( 11 | duration: new Duration(milliseconds: 300), 12 | opacity: isVisible ? 1.0 : 0.0, 13 | child: new Container( 14 | alignment: FractionalOffset.center, 15 | child: new Column( 16 | mainAxisAlignment: MainAxisAlignment.center, 17 | children: [ 18 | new Icon(Icons.info, color: Colors.green[200], size: 80.0), 19 | new Container( 20 | padding: new EdgeInsets.only(top: 16.0), 21 | child: new Text( 22 | "Enter a search term to begin", 23 | style: new TextStyle( 24 | color: Colors.green[100], 25 | ), 26 | ), 27 | ) 28 | ], 29 | ), 30 | ), 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /example/githubsearch/lib/search_loading_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SearchLoadingWidget extends StatelessWidget { 4 | final bool isLoading; 5 | 6 | SearchLoadingWidget(this.isLoading); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return new AnimatedOpacity( 11 | duration: new Duration(milliseconds: 300), 12 | opacity: isLoading ? 1.0 : 0.0, 13 | child: new Container( 14 | alignment: FractionalOffset.center, 15 | child: new CircularProgressIndicator(), 16 | ), 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /example/githubsearch/lib/search_result_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'github_search_api.dart'; 3 | import './SearchResult.dart'; 4 | 5 | class SearchResultWidget extends StatelessWidget { 6 | final SearchResult? result; 7 | 8 | SearchResultWidget(this.result); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return new AnimatedOpacity( 13 | duration: new Duration(milliseconds: 300), 14 | opacity: result != null && result!.isPopulated ? 1.0 : 0.0, 15 | child: new ListView.builder( 16 | itemCount: result?.items?.length ?? 0, 17 | itemBuilder: (context, index) { 18 | final item = result!.items[index]; 19 | return new InkWell( 20 | onTap: () => showItem(context, item), 21 | child: new Container( 22 | alignment: FractionalOffset.center, 23 | margin: new EdgeInsets.fromLTRB(16.0, 12.0, 16.0, 12.0), 24 | child: new Row( 25 | crossAxisAlignment: CrossAxisAlignment.start, 26 | children: [ 27 | new Container( 28 | margin: new EdgeInsets.only(right: 16.0), 29 | child: new Hero( 30 | tag: item.fullName, 31 | child: new ClipOval( 32 | child: new Image.network( 33 | item.avatarUrl, 34 | width: 56.0, 35 | height: 56.0, 36 | ), 37 | ), 38 | ), 39 | ), 40 | new Expanded( 41 | child: new Column( 42 | crossAxisAlignment: CrossAxisAlignment.start, 43 | children: [ 44 | new Container( 45 | margin: new EdgeInsets.only( 46 | top: 6.0, 47 | bottom: 4.0, 48 | ), 49 | child: new Text( 50 | "${item.fullName}", 51 | maxLines: 1, 52 | overflow: TextOverflow.ellipsis, 53 | style: new TextStyle( 54 | fontFamily: "Montserrat", 55 | fontSize: 16.0, 56 | fontWeight: FontWeight.bold, 57 | ), 58 | ), 59 | ), 60 | new Container( 61 | child: new Text( 62 | "${item.url}", 63 | style: new TextStyle( 64 | fontFamily: "Hind", 65 | ), 66 | maxLines: 1, 67 | overflow: TextOverflow.ellipsis, 68 | ), 69 | ) 70 | ], 71 | ), 72 | ) 73 | ], 74 | ), 75 | ), 76 | ); 77 | }, 78 | ), 79 | ); 80 | } 81 | 82 | void showItem(BuildContext context, SearchResultItem item) { 83 | Navigator.push( 84 | context, 85 | new MaterialPageRoute( 86 | builder: (BuildContext context) { 87 | return new Scaffold( 88 | resizeToAvoidBottomInset: false, 89 | body: new GestureDetector( 90 | key: new Key(item.avatarUrl), 91 | onTap: () => Navigator.pop(context), 92 | child: new SizedBox.expand( 93 | child: new Hero( 94 | tag: item.fullName, 95 | child: new Image.network( 96 | item.avatarUrl, 97 | width: MediaQuery.of(context).size.width, 98 | height: 300.0, 99 | ), 100 | ), 101 | ), 102 | ), 103 | ); 104 | }, 105 | ), 106 | ); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /example/githubsearch/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: githubsearch 2 | description: A new Flutter project. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # Read more about versioning at semver.org. 10 | version: 1.0.0+1 11 | 12 | environment: 13 | sdk: ">=2.12.0 <3.0.0" 14 | 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | flutter_redux: ^0.8.2 19 | redux_dev_tools: 20 | git: 21 | url: https://github.com/MichaelMarner/redux_dev_tools.git 22 | ref: null-safety 23 | async: ^2.5.0 24 | redux_epics: ^0.15.0 25 | rxdart: ^0.26.0 26 | json_annotation: ^4.0.0 27 | redux_remote_devtools: 28 | path: ../../ 29 | 30 | # The following adds the Cupertino Icons font to your application. 31 | # Use with the CupertinoIcons class for iOS style icons. 32 | cupertino_icons: ^1.0.2 33 | 34 | dev_dependencies: 35 | flutter_test: 36 | sdk: flutter 37 | build_runner: ^1.12.2 38 | json_serializable: ^4.0.3 39 | 40 | # For information on the generic Dart part of this file, see the 41 | # following page: https://www.dartlang.org/tools/pub/pubspec 42 | 43 | # The following section is specific to Flutter. 44 | flutter: 45 | # The following line ensures that the Material Icons font is 46 | # included with your application, so that you can use the icons in 47 | # the material Icons class. 48 | uses-material-design: true 49 | # To add assets to your application, add an assets section, like this: 50 | # assets: 51 | # - images/a_dot_burr.jpeg 52 | # - images/a_dot_ham.jpeg 53 | # An image asset can refer to one or more resolution-specific "variants", see 54 | # https://flutter.io/assets-and-images/#resolution-aware. 55 | # For details regarding adding assets from package dependencies, see 56 | # https://flutter.io/assets-and-images/#from-packages 57 | # To add custom fonts to your application, add a fonts section here, 58 | # in this "flutter" section. Each entry in this list should have a 59 | # "family" key with the font family name, and a "fonts" key with a 60 | # list giving the asset and other descriptors for the font. For 61 | # example: 62 | # fonts: 63 | # - family: Schyler 64 | # fonts: 65 | # - asset: fonts/Schyler-Regular.ttf 66 | # - asset: fonts/Schyler-Italic.ttf 67 | # style: italic 68 | # - family: Trajan Pro 69 | # fonts: 70 | # - asset: fonts/TrajanPro.ttf 71 | # - asset: fonts/TrajanPro_Bold.ttf 72 | # weight: 700 73 | # 74 | # For details regarding fonts from package dependencies, 75 | # see https://flutter.io/custom-fonts/#from-packages 76 | -------------------------------------------------------------------------------- /example/githubsearch/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter 3 | // provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to 4 | // find child widgets in the widget tree, read text, and verify that the values of widget properties 5 | // are correct. 6 | 7 | import 'package:flutter/material.dart'; 8 | import 'package:flutter_test/flutter_test.dart'; 9 | 10 | import 'package:githubsearch/main.dart'; 11 | 12 | void main() { 13 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 14 | // Build our app and trigger a frame. 15 | await tester.pumpWidget(new RxDartGithubSearchApp()); 16 | 17 | // Verify that our counter starts at 0. 18 | expect(find.text('0'), findsOneWidget); 19 | expect(find.text('1'), findsNothing); 20 | 21 | // Tap the '+' icon and trigger a frame. 22 | await tester.tap(find.byIcon(Icons.add)); 23 | await tester.pump(); 24 | 25 | // Verify that our counter has incremented. 26 | expect(find.text('0'), findsNothing); 27 | expect(find.text('1'), findsOneWidget); 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /lib/redux_remote_devtools.dart: -------------------------------------------------------------------------------- 1 | library redux_remote_devtools; 2 | 3 | import 'package:redux/redux.dart'; 4 | import 'package:socketcluster_client/socketcluster_client.dart'; 5 | import 'package:redux_dev_tools/redux_dev_tools.dart'; 6 | import 'dart:convert'; 7 | import 'dart:async'; 8 | 9 | part './src/action_decoder.dart'; 10 | part './src/action_encoder.dart'; 11 | part './src/remote_devtools_middleware.dart'; 12 | part './src/socketcluster_wrapper.dart'; 13 | part './src/state_encoder.dart'; 14 | -------------------------------------------------------------------------------- /lib/src/action_decoder.dart: -------------------------------------------------------------------------------- 1 | part of redux_remote_devtools; 2 | 3 | /// Interface for custom remote action decoding logic. 4 | /// Converts a JSON payload from remote devtools to an action 5 | typedef ActionDecoder = dynamic Function(dynamic json); 6 | 7 | /// An action decoder that simply passes through the JSON unmodified 8 | ActionDecoder NopActionDecoder = (dynamic action) => action; 9 | -------------------------------------------------------------------------------- /lib/src/action_encoder.dart: -------------------------------------------------------------------------------- 1 | part of redux_remote_devtools; 2 | 3 | /// Interface for custom action encoding logic. 4 | /// Converts an action into a string suitable for sending to devtools 5 | typedef ActionEncoder = String Function(dynamic action); 6 | 7 | /// An action encoder that converts an action to stringified JSON 8 | /// 9 | /// Encodes an action as stringified JSON 10 | /// 11 | /// Uses the form: 12 | /// 13 | /// { 14 | /// "type": "TYPE" 15 | /// "payload": jsonEncode(action) 16 | /// } 17 | /// 18 | /// Action type is set to be the class name for class based 19 | /// actions, or an enum value for enum actions 20 | /// 21 | ActionEncoder JsonActionEncoder = (dynamic action) { 22 | /// Gets a type name for the action, based on the class name or value 23 | String getActionType(dynamic action) { 24 | if (action.toString().contains('Instance of')) { 25 | return action.runtimeType.toString(); 26 | } 27 | return action.toString(); 28 | } 29 | 30 | try { 31 | return jsonEncode({'type': getActionType(action), 'payload': action}); 32 | } on Error { 33 | return jsonEncode({'type': getActionType(action)}); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /lib/src/remote_devtools_middleware.dart: -------------------------------------------------------------------------------- 1 | part of redux_remote_devtools; 2 | 3 | /// The connection state of the middleware 4 | enum RemoteDevToolsStatus { 5 | /// No socket connection to the remote host 6 | notConnected, 7 | 8 | /// Attempting to open socket 9 | connecting, 10 | 11 | /// Connected to remote, but not started 12 | connected, 13 | 14 | /// Awating start response 15 | starting, 16 | 17 | /// Sending and receiving actions 18 | started 19 | } 20 | 21 | class RemoteDevToolsMiddleware extends MiddlewareClass { 22 | /// 23 | /// The remote-devtools server to connect to. Should include 24 | /// protocol and port if necessary. For example: 25 | /// 26 | /// example.lan:8000 27 | /// 28 | /// 29 | final String _host; 30 | late SocketClusterWrapper socket; 31 | Store? store; 32 | late String _channel; 33 | RemoteDevToolsStatus status = RemoteDevToolsStatus.notConnected; 34 | 35 | /// The function used to decode actions. If not specifies, defaults to [NopActionDecoder] 36 | late ActionDecoder actionDecoder; 37 | 38 | /// The function used to encode actions to a String for sending. If not specifies, defaults to [JsonActionEncoder] 39 | late ActionEncoder actionEncoder; 40 | 41 | /// The function used to encode state to a String for sending. If not specifies, defaults to [JsonStateEncoder] 42 | late StateEncoder stateEncoder; 43 | 44 | /// The name that will appear in Instance Name in Dev Tools. If not specified, default to 'flutter'. 45 | String instanceName; 46 | 47 | RemoteDevToolsMiddleware( 48 | this._host, { 49 | ActionDecoder? actionDecoder, 50 | ActionEncoder? actionEncoder, 51 | StateEncoder? stateEncoder, 52 | SocketClusterWrapper? socket, 53 | this.instanceName = 'flutter', 54 | }) { 55 | this.actionEncoder = actionEncoder ?? JsonActionEncoder; 56 | this.actionDecoder = actionDecoder ?? NopActionDecoder; 57 | this.stateEncoder = stateEncoder ?? JsonStateEncoder; 58 | this.socket = socket ?? SocketClusterWrapper('ws://$_host/socketcluster/'); 59 | } 60 | 61 | Future connect() async { 62 | _setStatus(RemoteDevToolsStatus.connecting); 63 | await socket.connect(); 64 | _setStatus(RemoteDevToolsStatus.connected); 65 | _channel = await _login(); 66 | _setStatus(RemoteDevToolsStatus.starting); 67 | _relay('START'); 68 | await _waitForStart(); 69 | socket.on(_channel, (String? name, dynamic data) { 70 | handleEventFromRemote(data as Map); 71 | }); 72 | if (store != null) { 73 | _relay('ACTION', store!.state, 'CONNECT'); 74 | } 75 | } 76 | 77 | Future _waitForStart() { 78 | final c = Completer(); 79 | socket.on(_channel, (String? name, dynamic data) { 80 | if (data['type'] == 'START') { 81 | _setStatus(RemoteDevToolsStatus.started); 82 | c.complete(); 83 | } else { 84 | c.completeError(data); 85 | } 86 | }); 87 | return c.future; 88 | } 89 | 90 | Future _login() { 91 | final c = Completer(); 92 | socket.emit('login', 'master', (String name, dynamic error, dynamic data) { 93 | c.complete(data as String?); 94 | }); 95 | return c.future; 96 | } 97 | 98 | void _relay(String type, 99 | [State? state, dynamic action, String? nextActionId]) { 100 | var message = {'type': type, 'id': socket.id, 'name': instanceName}; 101 | 102 | if (state != null) { 103 | try { 104 | message['payload'] = stateEncoder(state); 105 | } catch (error) { 106 | message['payload'] = 107 | 'Could not encode state. Ensure state is json encodable'; 108 | } 109 | } 110 | if (type == 'ACTION') { 111 | message['action'] = actionEncoder(action); 112 | message['nextActionId'] = nextActionId; 113 | } else if (action != null) { 114 | message['action'] = action as String; 115 | } 116 | socket.emit(socket.id != null ? 'log' : 'log-noid', message); 117 | } 118 | 119 | void handleEventFromRemote(Map data) { 120 | switch (data['type'] as String?) { 121 | case 'DISPATCH': 122 | _handleDispatch(data['action']); 123 | break; 124 | // The START action is a response indicating that remote devtools is up and running 125 | case 'START': 126 | _setStatus(RemoteDevToolsStatus.started); 127 | break; 128 | case 'ACTION': 129 | _handleRemoteAction(data['action'] as String?); 130 | break; 131 | default: 132 | print('Unknown type:' + data['type'].toString()); 133 | } 134 | } 135 | 136 | void _handleDispatch(dynamic action) { 137 | if (store == null) { 138 | print('No store reference set, cannot dispatch remote action'); 139 | return; 140 | } 141 | switch (action['type'] as String?) { 142 | case 'JUMP_TO_STATE': 143 | store?.dispatch(DevToolsAction.jumpToState(action['index'] as int)); 144 | break; 145 | default: 146 | print("Unknown commans: ${action['type']}. Ignoring"); 147 | } 148 | } 149 | 150 | void _handleRemoteAction(String? action) { 151 | if (store == null) { 152 | print('No store reference set, cannot dispatch remote action'); 153 | return; 154 | } 155 | var actionMap = jsonDecode(action!); 156 | store?.dispatch(DevToolsAction.perform(actionDecoder(actionMap))); 157 | } 158 | 159 | /// Middleware function called by redux, dispatches actions to devtools 160 | @override 161 | void call(Store store, dynamic action, NextDispatcher next) { 162 | next(action); 163 | if (status == RemoteDevToolsStatus.started && !(action is DevToolsAction)) { 164 | _relay('ACTION', store.state, action); 165 | } 166 | } 167 | 168 | void _setStatus(RemoteDevToolsStatus value) { 169 | status = value; 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /lib/src/socketcluster_wrapper.dart: -------------------------------------------------------------------------------- 1 | part of redux_remote_devtools; 2 | 3 | typedef SocketFactory = Future Function(String url); 4 | 5 | class SocketClusterWrapper { 6 | Socket? _socket; 7 | SocketFactory socketFactory; 8 | String url; 9 | SocketClusterWrapper(this.url, {this.socketFactory = Socket.connect}); 10 | 11 | Future connect() async { 12 | _socket = await socketFactory(url); 13 | } 14 | 15 | Emitter on(String event, Function func) { 16 | return _socket!.on(event, func); 17 | } 18 | 19 | void emit(String event, Object data, [AckCall? ack]) { 20 | _socket!.emit(event, data, ack); 21 | } 22 | 23 | String? get id => _socket!.id; 24 | } 25 | -------------------------------------------------------------------------------- /lib/src/state_encoder.dart: -------------------------------------------------------------------------------- 1 | part of redux_remote_devtools; 2 | 3 | /// Interface for custom State encoding logic 4 | /// Converts a State instance into a string suitable for sending to devtools 5 | typedef StateEncoder = String Function(State state); 6 | 7 | /// A State encoder that converts a state instances to stringified JSON 8 | StateEncoder JsonStateEncoder = (dynamic state) => jsonEncode(state); 9 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: redux_remote_devtools 2 | description: Remote DevTools for Redux.dart. This package connects a Dart Redux store to the Remote Devtools Server, allowing the developer to inspect changes to the Redux Store during runtime. 3 | author: Michael Marner 4 | homepage: https://github.com/MichaelMarner/dart-redux-remote-devtools 5 | version: 3.0.0 6 | dependencies: 7 | redux: ^5.0.0 8 | redux_dev_tools: ^0.7.0 9 | socketcluster_client: ^0.3.0 10 | dev_dependencies: 11 | build_runner: ^1.10.0 12 | test: ^1.16.8 13 | mockito: ^5.0.2 14 | pedantic: ^1.11.0 15 | environment: 16 | sdk: '>=2.12.0 <3.0.0' 17 | -------------------------------------------------------------------------------- /test/action_decoder_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:test/test.dart'; 2 | import 'package:redux_remote_devtools/redux_remote_devtools.dart'; 3 | 4 | void main() { 5 | group('NOPActionDecoder', () { 6 | group('decode', () { 7 | test('Passes through the json payload', () { 8 | var payload = {'type': 'SOME ACTION', 'value': 123}; 9 | var decoder = NopActionDecoder; 10 | var result = decoder(payload); 11 | expect(result, payload); 12 | }); 13 | }); 14 | }); 15 | } 16 | -------------------------------------------------------------------------------- /test/action_encoder_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:test/test.dart'; 3 | import 'package:redux_remote_devtools/redux_remote_devtools.dart'; 4 | 5 | class TestAction { 6 | int? value; 7 | TestAction({this.value}); 8 | Map toJson() { 9 | return {'value': value}; 10 | } 11 | } 12 | 13 | enum EnumActions { SimpleEnumAction } 14 | 15 | void main() { 16 | group('JsonActionEncoder', () { 17 | group('encodeAction', () { 18 | test('Returns a jsonified action', () { 19 | var encoder = JsonActionEncoder; 20 | var result = encoder(TestAction(value: 5)); 21 | var decoded = jsonDecode(result); 22 | expect(decoded['type'], equals('TestAction')); 23 | expect(decoded['payload']['value'], equals(5)); 24 | }); 25 | 26 | test('Still returns the type if action is not jsonable', () { 27 | var encoder = JsonActionEncoder; 28 | var result = encoder(EnumActions.SimpleEnumAction); 29 | var decoded = jsonDecode(result); 30 | expect(decoded['type'], equals('EnumActions.SimpleEnumAction')); 31 | expect(decoded['payload'], equals(null)); 32 | }); 33 | }); 34 | }); 35 | } 36 | -------------------------------------------------------------------------------- /test/remote_devtools_middleware_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:mockito/annotations.dart'; 2 | import 'package:redux_remote_devtools/redux_remote_devtools.dart'; 3 | import 'package:mockito/mockito.dart'; 4 | import 'package:socketcluster_client/socketcluster_client.dart'; 5 | import 'package:test/test.dart'; 6 | import 'dart:async'; 7 | import 'dart:convert'; 8 | import 'package:redux/redux.dart'; 9 | import 'package:redux_dev_tools/redux_dev_tools.dart'; 10 | 11 | import 'remote_devtools_middleware_test.mocks.dart'; 12 | 13 | class Next { 14 | void next(action) {} 15 | } 16 | 17 | enum TestActions { SomeAction, SomeOtherAction } 18 | 19 | @GenerateMocks([Next, Store, SocketClusterWrapper]) 20 | void main() { 21 | group('RemoteDevtoolsMiddleware', () { 22 | group('constructor', () { 23 | test('socket is not connected', () { 24 | var socket = MockSocketClusterWrapper(); 25 | RemoteDevToolsMiddleware('example.com', socket: socket); 26 | verifyNever(socket.connect()); 27 | }); 28 | }); 29 | group('connect', () { 30 | late var socket; 31 | late RemoteDevToolsMiddleware devtools; 32 | setUp(() { 33 | socket = MockSocketClusterWrapper(); 34 | devtools = RemoteDevToolsMiddleware('example.com', socket: socket); 35 | }); 36 | test('it connects the socket', () { 37 | devtools.connect(); 38 | verify(socket.connect()); 39 | }); 40 | test('it sends the login message', () async { 41 | when(socket.connect()).thenAnswer((_) => Future.value()); 42 | when(socket.id).thenReturn('testId'); 43 | when(socket.on('data', captureAny)).thenAnswer((Invocation i) { 44 | Function fn = i.positionalArguments[1]; 45 | fn('name', {'type': 'START'}); 46 | return Emitter(); 47 | }); 48 | when(socket.emit('login', 'master', captureAny)) 49 | .thenAnswer((Invocation i) { 50 | Function fn = i.positionalArguments[2]; 51 | fn('testChannel', 'err', 'data'); 52 | }); 53 | await devtools.connect(); 54 | verify(socket.emit('login', 'master', captureAny)); 55 | }); 56 | test('it sends the start message message', () async { 57 | when(socket.emit('login', 'master', captureAny)) 58 | .thenAnswer((Invocation i) { 59 | Function fn = i.positionalArguments[2]; 60 | fn('testChannel', 'err', 'data'); 61 | return Emitter(); 62 | }); 63 | when(socket.id).thenReturn('testId'); 64 | when(socket.on('data', captureAny)).thenAnswer((Invocation i) { 65 | Function fn = i.positionalArguments[1]; 66 | fn('name', {'type': 'START'}); 67 | return Emitter(); 68 | }); 69 | await devtools.connect(); 70 | verify(socket.emit('log', 71 | {'type': 'START', 'id': 'testId', 'name': 'flutter'}, captureAny)); 72 | }); 73 | test('instance name is configurable', () async { 74 | final coolInstanceName = 'testName'; 75 | devtools = RemoteDevToolsMiddleware('example.com', 76 | socket: socket, instanceName: coolInstanceName); 77 | when(socket.emit('login', 'master', captureAny)) 78 | .thenAnswer((Invocation i) { 79 | Function fn = i.positionalArguments[2]; 80 | fn('testChannel', 'err', 'data'); 81 | return Emitter(); 82 | }); 83 | when(socket.id).thenReturn('testId'); 84 | when(socket.on('data', captureAny)).thenAnswer((Invocation i) { 85 | Function fn = i.positionalArguments[1]; 86 | fn('name', {'type': 'START'}); 87 | return Emitter(); 88 | }); 89 | await devtools.connect(); 90 | verify(socket.emit( 91 | 'log', 92 | {'type': 'START', 'id': 'testId', 'name': '$coolInstanceName'}, 93 | captureAny)); 94 | }); 95 | test('it is in STARTED state', () async { 96 | when(socket.connect()).thenAnswer((_) => Future.value()); 97 | when(socket.id).thenReturn('testId'); 98 | when(socket.on('data', captureAny)).thenAnswer((Invocation i) { 99 | Function fn = i.positionalArguments[1]; 100 | fn('name', {'type': 'START'}); 101 | return Emitter(); 102 | }); 103 | when(socket.emit('login', 'master', captureAny)) 104 | .thenAnswer((Invocation i) { 105 | Function fn = i.positionalArguments[2]; 106 | fn('testChannel', 'err', 'data'); 107 | return Emitter(); 108 | }); 109 | await devtools.connect(); 110 | expect(devtools.status, RemoteDevToolsStatus.started); 111 | }); 112 | test('it sends the state', () async { 113 | when(socket.emit('login', 'master', captureAny)) 114 | .thenAnswer((Invocation i) { 115 | Function fn = i.positionalArguments[2]; 116 | fn('testChannel', 'err', 'data'); 117 | return Emitter(); 118 | }); 119 | when(socket.on('data', captureAny)).thenAnswer((Invocation i) { 120 | Function fn = i.positionalArguments[1]; 121 | fn('name', {'type': 'START'}); 122 | return Emitter(); 123 | }); 124 | when(socket.id).thenReturn('testId'); 125 | var store = MockStore(); 126 | when(store.state).thenReturn('TEST STATE'); 127 | devtools.store = store; 128 | await devtools.connect(); 129 | verify(socket.emit('log', 130 | {'type': 'START', 'id': 'testId', 'name': 'flutter'}, captureAny)); 131 | verify(socket.emit( 132 | 'log', 133 | { 134 | 'type': 'ACTION', 135 | 'id': 'testId', 136 | 'name': 'flutter', 137 | 'payload': '"TEST STATE"', 138 | 'action': '{"type":"CONNECT","payload":"CONNECT"}', 139 | 'nextActionId': null 140 | }, 141 | captureAny)); 142 | }); 143 | }); 144 | group('call', () { 145 | late MockSocketClusterWrapper socket; 146 | late RemoteDevToolsMiddleware devtools; 147 | Next next = MockNext(); 148 | late Store store; 149 | setUp(() async { 150 | store = MockStore(); 151 | when(store.state).thenReturn({'state': 42}); 152 | socket = MockSocketClusterWrapper(); 153 | when(socket.emit('login', 'master', captureAny)) 154 | .thenAnswer((Invocation i) { 155 | Function fn = i.positionalArguments[2]; 156 | fn('testChannel', 'err', 'data'); 157 | }); 158 | when(socket.on('data', any)).thenAnswer((Invocation i) { 159 | Function fn = i.positionalArguments[1]; 160 | fn('name', {'type': 'START'}); 161 | return Emitter(); 162 | }); 163 | when(socket.id).thenReturn('testId'); 164 | when(socket.connect()).thenAnswer((_) => Future.value()); 165 | 166 | when(next.next(any)).thenReturn(null); 167 | devtools = RemoteDevToolsMiddleware('example.com', socket: socket); 168 | await devtools.connect(); 169 | }); 170 | test('nothing sent if status is not started', () { 171 | devtools.status = RemoteDevToolsStatus.starting; 172 | devtools.call(store, TestActions.SomeAction, next.next); 173 | verifyNever(socket.emit( 174 | 'log', 175 | { 176 | 'type': 'ACTION', 177 | 'id': 'testId', 178 | 'name': 'flutter', 179 | 'payload': '{"state":42}', 180 | 'action': '{"type":"TestActions.SomeAction"}', 181 | 'nextActionId': null 182 | }, 183 | captureAny)); 184 | }); 185 | test('the action and state are sent', () { 186 | devtools.status = RemoteDevToolsStatus.started; 187 | devtools.call(store, TestActions.SomeAction, next.next); 188 | verify(socket.emit( 189 | 'log', 190 | { 191 | 'type': 'ACTION', 192 | 'id': 'testId', 193 | 'name': 'flutter', 194 | 'payload': '{"state":42}', 195 | 'action': '{"type":"TestActions.SomeAction"}', 196 | 'nextActionId': null 197 | }, 198 | captureAny)); 199 | }); 200 | test('calls next', () { 201 | devtools.call(store, TestActions.SomeAction, next.next); 202 | verify(next.next(TestActions.SomeAction)); 203 | }); 204 | }); 205 | group('remote action', () { 206 | MockSocketClusterWrapper socket; 207 | late RemoteDevToolsMiddleware devtools; 208 | late MockStore store; 209 | setUp(() async { 210 | store = MockStore(); 211 | when(store.state).thenReturn({'state': 42}); 212 | socket = MockSocketClusterWrapper(); 213 | when(socket.emit('login', 'master', captureAny)) 214 | .thenAnswer((Invocation i) { 215 | Function fn = i.positionalArguments[2]; 216 | fn('testChannel', 'err', 'data'); 217 | }); 218 | when(socket.on('data', any)).thenAnswer((Invocation i) { 219 | Function fn = i.positionalArguments[1]; 220 | fn('name', {'type': 'START'}); 221 | return Emitter(); 222 | }); 223 | when(socket.id).thenReturn('testId'); 224 | when(socket.connect()).thenAnswer((_) => Future.value()); 225 | devtools = RemoteDevToolsMiddleware('example.com', socket: socket); 226 | devtools.store = store; 227 | await devtools.connect(); 228 | }); 229 | test('handles time travel', () { 230 | var remoteData = { 231 | 'type': 'DISPATCH', 232 | 'action': {'type': 'JUMP_TO_STATE', 'index': 4} 233 | }; 234 | when(store.dispatch(any)).thenAnswer((i) => i.positionalArguments[0]); 235 | devtools.handleEventFromRemote(remoteData); 236 | final DevToolsAction arg = 237 | verify(store.dispatch(captureAny)).captured.first; 238 | expect(arg.type, DevToolsActionTypes.JumpToState); 239 | expect(arg.position, 4); 240 | }); 241 | test('Dispatches arbitrary remote actions', () { 242 | var remoteData = { 243 | 'type': 'ACTION', 244 | 'action': '{"type": "TEST ACTION", "value": 12}' 245 | }; 246 | when(store.dispatch(any)).thenAnswer((i) => i.positionalArguments[0]); 247 | devtools.handleEventFromRemote(remoteData); 248 | print(jsonDecode(remoteData['action']!)); 249 | var expected = 250 | DevToolsAction.perform(jsonDecode(remoteData['action']!)); 251 | print(expected); 252 | var verifyResult = verify(store.dispatch(captureAny)).captured.first; 253 | expect(verifyResult.type, DevToolsActionTypes.PerformAction); 254 | expect(verifyResult.appAction['type'], 'TEST ACTION'); 255 | expect(verifyResult.appAction['value'], 12); 256 | }); 257 | test('Does not dispatch if store has not been sent', () { 258 | devtools.store = null; 259 | var remoteData = { 260 | 'type': 'DISPATCH', 261 | 'action': {'type': 'JUMP_TO_STATE', 'index': 4} 262 | }; 263 | expect( 264 | () => devtools.handleEventFromRemote(remoteData), returnsNormally); 265 | }); 266 | }); 267 | }); 268 | } 269 | -------------------------------------------------------------------------------- /test/remote_devtools_middleware_test.mocks.dart: -------------------------------------------------------------------------------- 1 | // Mocks generated by Mockito 5.0.2 from annotations 2 | // in redux_remote_devtools/test/remote_devtools_middleware_test.dart. 3 | // Do not manually edit this file. 4 | 5 | import 'dart:async' as _i6; 6 | 7 | import 'package:mockito/mockito.dart' as _i1; 8 | import 'package:redux/src/store.dart' as _i5; 9 | import 'package:redux_remote_devtools/redux_remote_devtools.dart' as _i7; 10 | import 'package:socketcluster_client/src/emitter.dart' as _i3; 11 | import 'package:socketcluster_client/src/socket.dart' as _i2; 12 | 13 | import 'remote_devtools_middleware_test.dart' as _i4; 14 | 15 | // ignore_for_file: comment_references 16 | // ignore_for_file: unnecessary_parenthesis 17 | 18 | class _FakeSocket extends _i1.Fake implements _i2.Socket {} 19 | 20 | class _FakeEmitter extends _i1.Fake implements _i3.Emitter {} 21 | 22 | /// A class which mocks [Next]. 23 | /// 24 | /// See the documentation for Mockito's code generation for more information. 25 | class MockNext extends _i1.Mock implements _i4.Next { 26 | MockNext() { 27 | _i1.throwOnMissingStub(this); 28 | } 29 | } 30 | 31 | /// A class which mocks [Store]. 32 | /// 33 | /// See the documentation for Mockito's code generation for more information. 34 | class MockStore extends _i1.Mock implements _i5.Store { 35 | MockStore() { 36 | _i1.throwOnMissingStub(this); 37 | } 38 | 39 | @override 40 | _i5.Reducer get reducer => (super.noSuchMethod( 41 | Invocation.getter(#reducer), 42 | returnValue: (State state, dynamic action) => null) 43 | as _i5.Reducer); 44 | @override 45 | set reducer(_i5.Reducer? _reducer) => 46 | super.noSuchMethod(Invocation.setter(#reducer, _reducer), 47 | returnValueForMissingStub: null); 48 | @override 49 | State get state => 50 | (super.noSuchMethod(Invocation.getter(#state), returnValue: null) 51 | as State); 52 | @override 53 | _i6.Stream get onChange => 54 | (super.noSuchMethod(Invocation.getter(#onChange), 55 | returnValue: Stream.empty()) as _i6.Stream); 56 | @override 57 | _i6.Future teardown() => 58 | (super.noSuchMethod(Invocation.method(#teardown, []), 59 | returnValue: Future.value(null)) as _i6.Future); 60 | } 61 | 62 | /// A class which mocks [SocketClusterWrapper]. 63 | /// 64 | /// See the documentation for Mockito's code generation for more information. 65 | class MockSocketClusterWrapper extends _i1.Mock 66 | implements _i7.SocketClusterWrapper { 67 | MockSocketClusterWrapper() { 68 | _i1.throwOnMissingStub(this); 69 | } 70 | 71 | @override 72 | _i7.SocketFactory get socketFactory => 73 | (super.noSuchMethod(Invocation.getter(#socketFactory), 74 | returnValue: (String url) => Future.value(_FakeSocket())) 75 | as _i7.SocketFactory); 76 | @override 77 | set socketFactory(_i7.SocketFactory? _socketFactory) => 78 | super.noSuchMethod(Invocation.setter(#socketFactory, _socketFactory), 79 | returnValueForMissingStub: null); 80 | @override 81 | String get url => 82 | (super.noSuchMethod(Invocation.getter(#url), returnValue: '') as String); 83 | @override 84 | set url(String? _url) => super.noSuchMethod(Invocation.setter(#url, _url), 85 | returnValueForMissingStub: null); 86 | @override 87 | _i6.Future connect() => 88 | (super.noSuchMethod(Invocation.method(#connect, []), 89 | returnValue: Future.value(null), 90 | returnValueForMissingStub: Future.value()) as _i6.Future); 91 | @override 92 | _i3.Emitter on(String? event, Function? func) => 93 | (super.noSuchMethod(Invocation.method(#on, [event, func]), 94 | returnValue: _FakeEmitter()) as _i3.Emitter); 95 | @override 96 | void emit(String? event, Object? data, [_i3.AckCall? ack]) => 97 | super.noSuchMethod(Invocation.method(#emit, [event, data, ack]), 98 | returnValueForMissingStub: null); 99 | } 100 | -------------------------------------------------------------------------------- /test/socketcluster_wrapper_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:mockito/annotations.dart'; 2 | import 'package:test/test.dart'; 3 | import 'package:mockito/mockito.dart'; 4 | import 'package:socketcluster_client/socketcluster_client.dart'; 5 | import 'dart:async'; 6 | import 'package:redux_remote_devtools/redux_remote_devtools.dart'; 7 | import 'socketcluster_wrapper_test.mocks.dart'; 8 | 9 | abstract class SocketFactory { 10 | Future connect(String url); 11 | } 12 | 13 | @GenerateMocks([Socket, SocketFactory]) 14 | void main() { 15 | group('SocketClusterWrapper', () { 16 | group('Constructor', () { 17 | test('It sets the URL', () { 18 | var wrapper = SocketClusterWrapper('ws://example.com'); 19 | expect(wrapper.url, 'ws://example.com'); 20 | }); 21 | test('Does not attempt to connect', () { 22 | var factory = MockSocketFactory(); 23 | SocketClusterWrapper('ws://example.com', 24 | socketFactory: factory.connect); 25 | verifyNever(factory.connect(captureAny)); 26 | }); 27 | }); 28 | 29 | group('connect', () { 30 | test('It calls connect with the correct URL', () { 31 | final factory = MockSocketFactory(); 32 | final s = MockSocket(); 33 | when(factory.connect('ws://example.com')) 34 | .thenAnswer((_) => Future.value(s)); 35 | final socket = SocketClusterWrapper('ws://example.com', 36 | socketFactory: factory.connect); 37 | socket.connect(); 38 | verify(factory.connect('ws://example.com')); 39 | }); 40 | }); 41 | 42 | group('on', () { 43 | test('It passes the args through', () async { 44 | var socket = MockSocket(); 45 | when(socket.on('testEvent', any)).thenReturn(Emitter()); 46 | var wrapper = SocketClusterWrapper('ws://example.com', 47 | socketFactory: (String s) => Future.value(socket)); 48 | var testFunc = () => 'asf'; 49 | await wrapper.connect(); 50 | wrapper.on('testEvent', testFunc); 51 | verify(socket.on('testEvent', testFunc)); 52 | }); 53 | }); 54 | 55 | group('emit', () { 56 | test('It passes the args through', () async { 57 | var socket = MockSocket(); 58 | when(socket.emit('event', 'data', any)).thenReturn(socket); 59 | var wrapper = SocketClusterWrapper('ws://example.com', 60 | socketFactory: (String s) => Future.value(socket)); 61 | var testFunc = (String s, dynamic err, dynamic data) => 'asf'; 62 | await wrapper.connect(); 63 | wrapper.emit('event', 'data', testFunc); 64 | verify(socket.emit('event', 'data', testFunc)); 65 | }); 66 | }); 67 | 68 | group('id', () { 69 | test('It passes the args through', () async { 70 | var socket = MockSocket(); 71 | when(socket.id).thenReturn('TestId'); 72 | var wrapper = SocketClusterWrapper('ws://example.com', 73 | socketFactory: (String s) => Future.value(socket)); 74 | await wrapper.connect(); 75 | expect(wrapper.id, 'TestId'); 76 | }); 77 | }); 78 | }); 79 | } 80 | -------------------------------------------------------------------------------- /test/socketcluster_wrapper_test.mocks.dart: -------------------------------------------------------------------------------- 1 | // Mocks generated by Mockito 5.0.2 from annotations 2 | // in redux_remote_devtools/test/socketcluster_wrapper_test.dart. 3 | // Do not manually edit this file. 4 | 5 | import 'dart:async' as _i6; 6 | 7 | import 'package:mockito/mockito.dart' as _i1; 8 | import 'package:socketcluster_client/src/channel.dart' as _i2; 9 | import 'package:socketcluster_client/src/emitter.dart' as _i4; 10 | import 'package:socketcluster_client/src/socket.dart' as _i3; 11 | 12 | import 'socketcluster_wrapper_test.dart' as _i5; 13 | 14 | // ignore_for_file: comment_references 15 | // ignore_for_file: unnecessary_parenthesis 16 | 17 | class _FakeChannel extends _i1.Fake implements _i2.Channel {} 18 | 19 | class _FakeSocket extends _i1.Fake implements _i3.Socket {} 20 | 21 | class _FakeEmitter extends _i1.Fake implements _i4.Emitter {} 22 | 23 | /// A class which mocks [Socket]. 24 | /// 25 | /// See the documentation for Mockito's code generation for more information. 26 | class MockSocket extends _i1.Mock implements _i3.Socket { 27 | MockSocket() { 28 | _i1.throwOnMissingStub(this); 29 | } 30 | 31 | @override 32 | List<_i2.Channel> get channels => 33 | (super.noSuchMethod(Invocation.getter(#channels), 34 | returnValue: <_i2.Channel>[]) as List<_i2.Channel>); 35 | @override 36 | int get state => 37 | (super.noSuchMethod(Invocation.getter(#state), returnValue: 0) as int); 38 | @override 39 | void setProxy(String? host, int? port) => 40 | super.noSuchMethod(Invocation.method(#setProxy, [host, port]), 41 | returnValueForMissingStub: null); 42 | @override 43 | void setSSLCertVerification(bool? value) => 44 | super.noSuchMethod(Invocation.method(#setSSLCertVerification, [value]), 45 | returnValueForMissingStub: null); 46 | @override 47 | _i2.Channel createChannel(String? name) => 48 | (super.noSuchMethod(Invocation.method(#createChannel, [name]), 49 | returnValue: _FakeChannel()) as _i2.Channel); 50 | @override 51 | _i4.AckCall ack(int? cid) => 52 | (super.noSuchMethod(Invocation.method(#ack, [cid]), 53 | returnValue: (String name, dynamic error, dynamic data) => null) 54 | as _i4.AckCall); 55 | @override 56 | _i3.Socket emit(String? event, Object? data, [_i4.AckCall? ack]) => 57 | (super.noSuchMethod(Invocation.method(#emit, [event, data, ack]), 58 | returnValue: _FakeSocket()) as _i3.Socket); 59 | @override 60 | _i3.Socket subscribe(String? channel, [_i4.AckCall? ack]) => 61 | (super.noSuchMethod(Invocation.method(#subscribe, [channel, ack]), 62 | returnValue: _FakeSocket()) as _i3.Socket); 63 | @override 64 | _i3.Socket unsubscribe(String? channel, [_i4.AckCall? ack]) => 65 | (super.noSuchMethod(Invocation.method(#unsubscribe, [channel, ack]), 66 | returnValue: _FakeSocket()) as _i3.Socket); 67 | @override 68 | _i3.Socket publish(String? channel, Object? data, [_i4.AckCall? ack]) => 69 | (super.noSuchMethod(Invocation.method(#publish, [channel, data, ack]), 70 | returnValue: _FakeSocket()) as _i3.Socket); 71 | @override 72 | List getAckObject(String? event, _i4.AckCall? ack) => 73 | (super.noSuchMethod(Invocation.method(#getAckObject, [event, ack]), 74 | returnValue: []) as List); 75 | @override 76 | _i4.Emitter on(String? event, Function? func) => 77 | (super.noSuchMethod(Invocation.method(#on, [event, func]), 78 | returnValue: _FakeEmitter()) as _i4.Emitter); 79 | @override 80 | _i4.Emitter onSubscribe(String? event, _i4.Listener? fn) => 81 | (super.noSuchMethod(Invocation.method(#onSubscribe, [event, fn]), 82 | returnValue: _FakeEmitter()) as _i4.Emitter); 83 | @override 84 | _i4.Emitter handleEmit(String? event, dynamic object) => 85 | (super.noSuchMethod(Invocation.method(#handleEmit, [event, object]), 86 | returnValue: _FakeEmitter()) as _i4.Emitter); 87 | @override 88 | _i4.Emitter handleEmitAck(String? event, dynamic object, _i4.AckCall? ack) => 89 | (super.noSuchMethod( 90 | Invocation.method(#handleEmitAck, [event, object, ack]), 91 | returnValue: _FakeEmitter()) as _i4.Emitter); 92 | @override 93 | _i4.Emitter handlePublish(String? event, dynamic object) => 94 | (super.noSuchMethod(Invocation.method(#handlePublish, [event, object]), 95 | returnValue: _FakeEmitter()) as _i4.Emitter); 96 | @override 97 | bool hasEventAck(String? event) => 98 | (super.noSuchMethod(Invocation.method(#hasEventAck, [event]), 99 | returnValue: false) as bool); 100 | } 101 | 102 | /// A class which mocks [SocketFactory]. 103 | /// 104 | /// See the documentation for Mockito's code generation for more information. 105 | class MockSocketFactory extends _i1.Mock implements _i5.SocketFactory { 106 | MockSocketFactory() { 107 | _i1.throwOnMissingStub(this); 108 | } 109 | 110 | @override 111 | _i6.Future<_i3.Socket> connect(String? url) => 112 | (super.noSuchMethod(Invocation.method(#connect, [url]), 113 | returnValue: Future.value(_FakeSocket())) as _i6.Future<_i3.Socket>); 114 | } 115 | -------------------------------------------------------------------------------- /test/state_encoder_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:test/test.dart'; 3 | import 'package:redux_remote_devtools/redux_remote_devtools.dart'; 4 | 5 | class TestState { 6 | int? value; 7 | TestState({this.value}); 8 | Map toJson() { 9 | return {'value': value}; 10 | } 11 | } 12 | 13 | class TestUnencodableState { 14 | int? value; 15 | TestUnencodableState({this.value}); 16 | } 17 | 18 | enum EnumActions { SimpleEnumAction } 19 | 20 | void main() { 21 | group('JsonStateEncoder', () { 22 | group('encode', () { 23 | test('Returns a jsonified state', () { 24 | var encoder = JsonStateEncoder; 25 | var result = encoder(TestState(value: 5)); 26 | var decoded = jsonDecode(result); 27 | expect(decoded['value'], equals(5)); 28 | }); 29 | test('Throws an exception if unencodable', () { 30 | var encoder = JsonStateEncoder; 31 | var testFunc = () { 32 | encoder(TestUnencodableState(value: 5)); 33 | }; 34 | expect(testFunc, throwsA(TypeMatcher())); 35 | }); 36 | }); 37 | }); 38 | } 39 | -------------------------------------------------------------------------------- /test/test_all.dart: -------------------------------------------------------------------------------- 1 | import 'action_decoder_test.dart' as action_decoder; 2 | import 'action_encoder_test.dart' as action_encoder; 3 | import 'socketcluster_wrapper_test.dart' as socket_wrapper; 4 | import 'state_encoder_test.dart' as state_encoder; 5 | import 'remote_devtools_middleware_test.dart' as devtools; 6 | 7 | /// Script for running all tests on Travis CI 8 | /// Allows us to generate code coverage 9 | void main() { 10 | action_decoder.main(); 11 | action_encoder.main(); 12 | state_encoder.main(); 13 | devtools.main(); 14 | socket_wrapper.main(); 15 | } 16 | -------------------------------------------------------------------------------- /tool/travis.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 4 | # for details. All rights reserved. Use of this source code is governed by a 5 | # BSD-style license that can be found in the LICENSE file. 6 | 7 | # Fast fail the script on failures. 8 | set -e 9 | 10 | # Run pub get to fetch packages. 11 | dart pub get 12 | dart pub global activate coverage 13 | 14 | # Run the tests. 15 | # echo "Running tests..." 16 | # dart run test --reporter expanded 17 | 18 | # Gather coverage and upload to Coveralls. 19 | OBS_PORT=9292 20 | echo "Collecting coverage on port $OBS_PORT..." 21 | 22 | # Run the coverage collector to generate the JSON coverage report. 23 | dart pub global run coverage:collect_coverage \ 24 | --port=$OBS_PORT \ 25 | --out=var/coverage.json \ 26 | --wait-paused \ 27 | --resume-isolates & 28 | 29 | # Start tests in one VM. 30 | dart \ 31 | --disable-service-auth-codes \ 32 | --enable-vm-service=$OBS_PORT \ 33 | --pause-isolates-on-exit \ 34 | test/test_all.dart 35 | 36 | echo "Generating LCOV report..." 37 | format_coverage \ 38 | --lcov \ 39 | --in=var/coverage.json \ 40 | --out=var/lcov.info \ 41 | --packages=.packages \ 42 | --report-on=lib --------------------------------------------------------------------------------