Skip to content

Flutter Movies (TMDB API) app using non-magic state management

License

Notifications You must be signed in to change notification settings

tolo/tmdb_movie_app

 
 

Repository files navigation

Flutter Movies app with Result Notifier (TMDB API)

This is a fork of TMDB Movies by Andrea Bizzotto, refactored to use the ResultNotifier package instead of Riverpod.

Packages in use

Getting a TMDB API key

This project uses the TMDB API to get the latest movies data.

Before running the app you need to sign up on the TMDB website, then obtain an API key on the settings API page.

Once you have this, create an .env file at the root of the project and add your key:

// .env
TMDB_KEY=your-api-key

Then, run the code generator:

dart run build_runner build --delete-conflicting-outputs

This will generate a env.g.dart file inside lib/env. This contains the tmdbApiKey that is used when making requests to the TMDB API.

Congratulations, you're good to go. 😎

Note: Loading images from insecure HTTP endpoints

The data returned by the TMBD API points to image URLs using http rather than https. In order for images to load correctly, the following changes have been made:

Android

Created a file at android/app/src/main/res/xml/network_security_config.xml with these contents:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>

Added this to the application tag in the AndroidManifest.xml:

android:networkSecurityConfig="@xml/network_security_config"

iOS

Add the following to ios/Runner/info.pList:

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

More information here:

macOS

Since macOS applications are sandboxed by default, we get a SocketException if we haven't added the required entitlements. This has been fixes by adding these lines to macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements:

<key>com.apple.security.network.client</key>
<true/>

More info here:

About

Flutter Movies (TMDB API) app using non-magic state management

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 40.2%
  • C++ 25.6%
  • CMake 22.9%
  • Ruby 5.2%
  • HTML 2.3%
  • C 1.7%
  • Other 2.1%