├── .github
└── workflows
│ ├── checks.yml
│ ├── greetings.yml
│ ├── licenses.yml
│ ├── pana.yml
│ └── publish.yml
├── .gitignore
├── CODEOWNERS
├── LICENSE
├── README.md
└── url_strategy
├── .gitignore
├── .metadata
├── CHANGELOG.md
├── LICENSE
├── README.md
├── example
├── .gitignore
├── .metadata
├── README.md
├── lib
│ └── main.dart
├── pubspec.lock
├── pubspec.yaml
└── web
│ ├── favicon.png
│ ├── icons
│ ├── Icon-192.png
│ └── Icon-512.png
│ ├── index.html
│ └── manifest.json
├── lib
├── src
│ ├── url_strategy_non_web.dart
│ └── url_strategy_web.dart
└── url_strategy.dart
└── pubspec.yaml
/.github/workflows/checks.yml:
--------------------------------------------------------------------------------
1 | name: Checks
2 |
3 | on:
4 | pull_request:
5 | branches:
6 | - main
7 | paths:
8 | - '**/lib/**'
9 | - '**/android/**'
10 | - '**/ios/**'
11 | - '**/pubspec.yaml'
12 | - '**/test/**'
13 | - '**/test_driver/**'
14 | - '**/assets/**'
15 | - '**/integration_test/**'
16 |
17 | jobs:
18 | analyze:
19 | timeout-minutes: 7
20 | runs-on: ubuntu-latest
21 | name: Analysis of ${{ matrix.package }} (${{ matrix.channel }})
22 | strategy:
23 | matrix:
24 | channel:
25 | - 'stable'
26 | - 'beta'
27 | - 'dev'
28 | package:
29 | - 'url_strategy'
30 | fail-fast: false
31 |
32 | steps:
33 | - uses: actions/checkout@v2.3.3
34 | - uses: subosito/flutter-action@v1.4.0
35 | with:
36 | channel: ${{ matrix.channel }}
37 | - run: flutter pub get
38 | working-directory: ${{ matrix.package }}
39 | - name: Check format
40 | working-directory: ${{ matrix.package }}
41 | run: dart format . --set-exit-if-changed
42 | - run: flutter analyze
43 | working-directory: ${{ matrix.package }}
44 |
--------------------------------------------------------------------------------
/.github/workflows/greetings.yml:
--------------------------------------------------------------------------------
1 | name: greetings
2 |
3 | on:
4 | - pull_request_target
5 | - issues
6 |
7 | jobs:
8 | greeting:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/first-interaction@v1
12 | with:
13 | repo-token: ${{ secrets.GITHUB_TOKEN }}
14 | issue-message: |
15 | Hi 👋🏽 Thank you for opening your first issue with simpleclub/url_strategy ❤
16 |
17 | You can expect triage from us soon 🙂
18 | In the meantime, you can try to search for similar issues in our [issue database].
19 |
20 | [issue database]: https://github.com/simpleclub/url_strategy/issues?q=is%3Aissue
21 | pr-message: |
22 | Hi 👋🏽 Thank you for opening your first PR with simpleclub/url_strategy ❤
23 |
24 | You can expect a review from us soon ☺️
25 | In the meantime, please check our [contribution guidelines], the PR checklist, and the PR checks.
26 |
27 | [contribution guidelines]: https://github.com/simpleclub/url_strategy/blob/main/CONTRIBUTING.md
28 |
--------------------------------------------------------------------------------
/.github/workflows/licenses.yml:
--------------------------------------------------------------------------------
1 | name: Licenses
2 |
3 | on:
4 | schedule:
5 | - cron: '0 0 1 1 *'
6 | workflow_dispatch:
7 |
8 | jobs:
9 | years:
10 | timeout-minutes: 11
11 | runs-on: ubuntu-latest
12 | name: Update copyright year(s)
13 |
14 | steps:
15 | - uses: actions/checkout@v2
16 | with:
17 | fetch-depth: 0
18 | - uses: FantasticFiasco/action-update-license-year@v2
19 | with:
20 | token: ${{ secrets.GITHUB_TOKEN }}
21 | path: '**/LICENSE'
22 | commitTitle: Update copyright year in LICENSE file(s)
23 | commitAuthorName: simpleclub-bot
24 | commitAuthorEmail: developers@simpleclub.com
25 | prTitle: Update copyright year in LICENSE file(s)
26 | prBody: New Year is here and we want to keep up with time :)
27 |
--------------------------------------------------------------------------------
/.github/workflows/pana.yml:
--------------------------------------------------------------------------------
1 | name: Pana
2 |
3 | on:
4 | pull_request:
5 | branches:
6 | - main
7 | paths:
8 | - '**/lib/**'
9 | - '**/android/**'
10 | - '**/ios/**'
11 | - '**/pubspec.yaml'
12 | - '**/test/**'
13 | - '**/test_driver/**'
14 | - '**/assets/**'
15 | - '**/integration_test/**'
16 |
17 | jobs:
18 | configure:
19 | timeout-minutes: 9
20 | runs-on: ubuntu-latest
21 | name: Configuration of ${{ matrix.package }}
22 | strategy:
23 | matrix:
24 | package:
25 | - 'url_strategy'
26 | fail-fast: false
27 |
28 | steps:
29 | - uses: actions/checkout@v2.3.3
30 | - uses: axel-op/dart-package-analyzer@v3
31 | with:
32 | relativePath: ${{ matrix.package }}
33 | githubToken: ${{ secrets.GITHUB_TOKEN }}
34 |
--------------------------------------------------------------------------------
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | name: Publish to pub.dev
2 |
3 | on:
4 | push:
5 | tags:
6 | # Must align with the tag-pattern configured on pub.dev.
7 | - 'url_strategy-v[0-9]+.[0-9]+.[0-9]+*'
8 |
9 | jobs:
10 | pana:
11 | timeout-minutes: 9
12 | runs-on: ubuntu-latest
13 | name: Configuration of ${{ matrix.package }}
14 | strategy:
15 | matrix:
16 | package:
17 | - 'url_strategy'
18 | fail-fast: false
19 |
20 | steps:
21 | - uses: actions/checkout@v2.3.3
22 | - uses: axel-op/dart-package-analyzer@v3
23 | with:
24 | relativePath: ${{ matrix.package }}
25 | githubToken: ${{ secrets.GITHUB_TOKEN }}
26 |
27 | publish:
28 | needs: pana
29 | timeout-minutes: 4
30 | runs-on: ubuntu-latest
31 | name: Publishing of ${{ matrix.package }}
32 | permissions:
33 | id-token: write # Allows to publish to pub.dev without personal credentials
34 | strategy:
35 | matrix:
36 | package:
37 | - 'url_strategy'
38 | fail-fast: false
39 |
40 | steps:
41 | - uses: actions/checkout@v2.3.3
42 | with:
43 | fetch-depth: 2
44 |
45 | - uses: dart-lang/setup-dart@v1
46 | - uses: subosito/flutter-action@v2
47 | with:
48 | channel: 'stable'
49 | - run: flutter pub get
50 | working-directory: ${{ matrix.package }}
51 | - run: flutter pub publish --dry-run
52 | working-directory: ${{ matrix.package }}
53 | - run: flutter pub publish --force
54 | working-directory: ${{ matrix.package }}
55 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @creativecreatorormaybenot
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2021-2024, simpleclub
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | 3. Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # url_strategy [](https://pub.dev/packages/url_strategy)
2 |
3 | > ⚠️ **Discontinued**: The functionality is now provided by the flutter SDK out of the box:
4 | >
5 | > https://docs.flutter.dev/ui/navigation/url-strategies
6 |
7 | Package for Flutter apps that allows setting the web URL strategy with a single line of code.
8 |
9 | ## Usage
10 |
11 | With a simple call of `setPathUrlStrategy`, your Flutter web app does not have a leading `#`
12 | in the URL anymore 🚀
13 |
14 | ```dart
15 | import 'package:url_strategy/url_strategy.dart';
16 |
17 | void main() {
18 | // Here we set the URL strategy for our web app.
19 | // It is safe to call this function when running on mobile or desktop as well.
20 | setPathUrlStrategy();
21 | runApp(MyApp());
22 | }
23 | ```
24 |
25 | See the [`url_strategy` package README](https://github.com/simpleclub/url_strategy/tree/master/url_strategy)
26 | or the [explanation on StackOverflow](https://stackoverflow.com/a/65709246/6509751) for more detailed usage documentation.
27 |
28 | ## Implementation
29 |
30 | The package is basically a wrapper around the [`flutter_web_plugins`](https://github.com/flutter/flutter/tree/master/packages/flutter_web_plugins)
31 | `setUrlStrategy`. The reason it exists is that using the function from `flutter_web_plugins`
32 | requires conditional imports.
33 | The problem is solved by using a conditional export from the `url_strategy` package.
34 |
--------------------------------------------------------------------------------
/url_strategy/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | .dart_tool/
26 | .flutter-plugins
27 | .flutter-plugins-dependencies
28 | .packages
29 | .pub-cache/
30 | .pub/
31 | pubspec.lock
32 | build/
33 |
34 | # Android related
35 | **/android/**/gradle-wrapper.jar
36 | **/android/.gradle
37 | **/android/captures/
38 | **/android/gradlew
39 | **/android/gradlew.bat
40 | **/android/local.properties
41 | **/android/**/GeneratedPluginRegistrant.java
42 |
43 | # iOS/XCode related
44 | **/ios/**/*.mode1v3
45 | **/ios/**/*.mode2v3
46 | **/ios/**/*.moved-aside
47 | **/ios/**/*.pbxuser
48 | **/ios/**/*.perspectivev3
49 | **/ios/**/*sync/
50 | **/ios/**/.sconsign.dblite
51 | **/ios/**/.tags*
52 | **/ios/**/.vagrant/
53 | **/ios/**/DerivedData/
54 | **/ios/**/Icon?
55 | **/ios/**/Pods/
56 | **/ios/**/.symlinks/
57 | **/ios/**/profile
58 | **/ios/**/xcuserdata
59 | **/ios/.generated/
60 | **/ios/Flutter/App.framework
61 | **/ios/Flutter/Flutter.framework
62 | **/ios/Flutter/Flutter.podspec
63 | **/ios/Flutter/Generated.xcconfig
64 | **/ios/Flutter/app.flx
65 | **/ios/Flutter/app.zip
66 | **/ios/Flutter/flutter_assets/
67 | **/ios/Flutter/flutter_export_environment.sh
68 | **/ios/ServiceDefinitions.json
69 | **/ios/Runner/GeneratedPluginRegistrant.*
70 |
71 | # Exceptions to above rules.
72 | !**/ios/**/default.mode1v3
73 | !**/ios/**/default.mode2v3
74 | !**/ios/**/default.pbxuser
75 | !**/ios/**/default.perspectivev3
76 |
--------------------------------------------------------------------------------
/url_strategy/.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: b9d06fffb2db263ab7021fc39adde7f2bf988a4a
8 | channel: dev
9 |
10 | project_type: package
11 |
--------------------------------------------------------------------------------
/url_strategy/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.3.0
2 |
3 | * Migrated to js_interop. (#42)
4 |
5 | ## 0.2.0
6 |
7 | * Bumped to stable null safety release.
8 |
9 | ## 0.2.0-nullsafety.0
10 |
11 | * Migrated to NNBD.
12 |
13 | ## 0.1.1
14 |
15 | * Updated README and names.
16 |
17 | ## 0.1.0+1
18 |
19 | * Added link to more detailed explanation in README.
20 |
21 | ## 0.1.0
22 |
23 | * Initial release.
24 |
--------------------------------------------------------------------------------
/url_strategy/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2021-2024, simpleclub
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | 3. Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/url_strategy/README.md:
--------------------------------------------------------------------------------
1 | # url_strategy [](https://github.com/simpleclub/url_strategy)
2 |
3 | Package for Flutter apps that allows setting the web URL strategy with a single line of code.
4 |
5 | ## Usage
6 |
7 | To use this plugin, follow the [installing guide](https://pub.dev/packages/url_strategy/install).
8 |
9 | ### Setting the URL strategy
10 |
11 | If you want to remove the leading hash (`#`) from the URL of your Flutter web app, you can simply
12 | call `setPathUrlStrategy` in the `main` function of your app:
13 |
14 | ```dart
15 | import 'package:url_strategy/url_strategy.dart';
16 |
17 | void main() {
18 | // Here we set the URL strategy for our web app.
19 | // It is safe to call this function when running on mobile or desktop as well.
20 | setPathUrlStrategy();
21 | runApp(MyApp());
22 | }
23 | ```
24 |
25 | Now, your Flutter web app will not have a leading `#` in the URL anymore.
26 |
27 | It is safe to call the function even when running on any other platform than web (which is the point
28 | of this package). That means that you can safely call `setPathUrlStrategy` when running on mobile
29 | or desktop - it will simply be a noop.
30 |
31 | #### Base
32 |
33 | Make sure that you have `