Skip to content

oyen-bright/smart_car_authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smart_car_authentication

Integrate Smartcar into your Flutter app effortlessly to retrieve vehicle data and trigger actions with our simple and secure car API.

Flutter Plugin Built on Smartcar Native SDKs

This Flutter plugin is built upon Smartcar's native SDKs for both iOS and Android, ensuring seamless integration with your Flutter app. For more details on Smartcar's native SDKs, you can refer to the official documentation:

Getting Started

1. Register Your App

  • Obtain your clientId by registering your application on the Smartcar dashboard.
  • Set up the required permissions based on your use case.

2. Install the Plugin

Add the Smartcar Flutter plugin to your pubspec.yaml file:

dependencies:
  smartcar_flutter: ^1.0.0

3. Initialize Smartcar

Configure Smartcar with your credentials and required permission

await Smartcar.setup(
  configuration: const SmartcarConfig(
    clientId: "{YOUR_CLIENT_ID}",
    redirectUri: "sc{YOUR_CLIENT_ID}://{YOUR_HOST}",
    scopes: [SmartcarPermission.readOdometer],
    testMode: true,
  ),
);

4. Launch Authentication Flow

Start the Smartcar authentication flow:

await Smartcar.launchAuthFlow();

5. Listen for Smartcar Responses

Subscribe to the onSmartcarResponse stream to receive authentication responses:

Smartcar.onSmartcarResponse.listen((SmartcarAuthResponse response) {
  // Handle the authentication response
  print("Received Smartcar response: ${response.code}");
});

Smartcar Permissions

The plugin supports a variety of permissions, allowing you to access specific vehicle information. For a detailed list, refer to the Smartcar Permissions Documentation.

Example

Here's a quick example demonstrating the Smartcar Flutter plugin usage:

// Initialize Smartcar
await Smartcar.setup(
  configuration: const SmartcarConfig(
    clientId: "{YOUR_CLIENT_ID}",
    redirectUri: "sc{YOUR_CLIENT_ID}://{YOUR_HOST}",
    scopes: [SmartcarPermission.readOdometer],
    testMode: true,
  ),
);

// Launch Smartcar authentication flow
await Smartcar.launchAuthFlow();

// Listen for Smartcar responses
Smartcar.onSmartcarResponse.listen((SmartcarAuthResponse response) {
  // Handle the authentication response
  print("Received Smartcar response: ${response.code}");
});

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published