moveme_score 1.3.1 copy "moveme_score: ^1.3.1" to clipboard
moveme_score: ^1.3.1 copied to clipboard

SDK oficial MoveMe para o Score Service — avaliações desacopladas (motorista/passageiro), score público, unmatch e rating protection.

example/main.dart

/// Exemplo de uso do moveme_score.
///
/// dart run example/main.dart
library;

import 'dart:io';

import 'package:moveme_score/moveme_score.dart';

Future<void> main() async {
  final baseUrl = Platform.environment['SCORE_BASE_URL'] ?? 'http://127.0.0.1:8787';
  final apiKey = Platform.environment['SCORE_API_KEY'];

  if (apiKey == null || apiKey.isEmpty) {
    stderr.writeln('Defina SCORE_API_KEY (e opcionalmente SCORE_BASE_URL)');
    exit(1);
  }

  final client = ScoreClient(baseUrl: baseUrl, apiKey: apiKey);

  final ok = await client.health();
  stdout.writeln('health: $ok');

  final reasons = await client.listRatingReasons();
  stdout.writeln('reasons: ${reasons.length}');

  final stamp = DateTime.now().millisecondsSinceEpoch;
  final alice = await client.registerUser(
    name: 'Alice Flutter',
    uidExternal: 'flutter-alice-$stamp',
  );
  final bob = await client.registerUser(
    name: 'Bob Flutter',
    uidExternal: 'flutter-bob-$stamp',
  );

  final trip = await client.createTrip(
    driverId: alice.id,
    riderId: bob.id,
    startLocation: 'A',
    endLocation: 'B',
    price: 25,
  );
  await client.startTrip(trip.id);
  await client.completeTrip(trip.id);

  await client.submitRating(
    tripId: trip.id,
    fromUserId: bob.id,
    score: 5,
    comment: 'via Flutter SDK',
  );
  await client.submitRating(
    tripId: trip.id,
    fromUserId: alice.id,
    score: 4,
  );

  final score = await client.getScore(alice.id);
  stdout.writeln('Alice score: ${score?.avgScore} (${score?.totalRatings})');

  client.close();
}
0
likes
150
points
19
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

SDK oficial MoveMe para o Score Service — avaliações desacopladas (motorista/passageiro), score público, unmatch e rating protection.

Homepage
Repository (GitHub)
View/report issues

Topics

#score #rating #moveme #flutter #api-client

License

MIT (license)

Dependencies

http, meta

More

Packages that depend on moveme_score