Skip to content

Flutter project example covering concerns commonly encountered in business apps.

License

Notifications You must be signed in to change notification settings

asc-lab/personal-insurance-flutter-poc

Repository files navigation

Flutter PoC: Personal Insurance

A Flutter project example covering concerns commonly encountered in business apps.


Blog Post

https://altkomsoftware.pl/blog/flutter-dart-quickly-build-mobile-app-without-losing-much-hair/

Dependency

The application attempts to access a running Mockoon Mock API at startup. If the local server is not running, application will simply fail with a blank screen.


Running

  • Ensure Mockoon Environment is configured with mockoon_environment - (import JSON into Mockoon).
  • Ensure Mockoon is running locally
  • Ensure API routes are accessible on 0.0.0.0 i.e. localhost, 127.0.0.1
  • Ensure the apiURL static field in lib/services/Helper class is correctly set
    • Localhost setting for apiURL for The Android and iOS will differ, see below.
    • The helper will auto-adapt the apiURL based on Platform.

If the local server is not running, application will show an error on startup.


Android

  • apiURL = "http://10.0.2.2:3000/personalInsuranceFlutter/";
  • Ensure the emulator can access localhost via 10.0.2.2 in Dart code.

iOS

  • apiURL = "http://localhost:3000/personalInsuranceFlutter/";

The iOS Simulator uses the host machine network so you should be able to just use localhost or your machines IP address, whichever IP your web service is listening on.

More info on https://stackoverflow.com/questions/6077888/how-do-i-access-the-host-machine-itself-from-the-iphone-simulator

You will need to add the following to the project's Info.plist.

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
        <true/>
</dict>  

Otherwise this error is going to happen.

Cannot start load of Task <xx-xx>.<x> since it does not conform to ATS policy.

About

Flutter project example covering concerns commonly encountered in business apps.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published