what3words 3.1.0-nullsafety.3 copy "what3words: ^3.1.0-nullsafety.3" to clipboard
what3words: ^3.1.0-nullsafety.3 copied to clipboard

outdated

A Dart library to use the what3words v3 API. This library can either be used in native Dart or Flutter applications

example/example.dart

import 'package:what3words/what3words.dart';

void main() async {
  // For all requests a what3words API key is needed
  var api = What3WordsV3('what3words-api-key');

  // Create and execute a request to obtain a grid section within the provided bounding box
  var coordinates = await api.convertToCoordinates('index.home.raft').execute();

  if (coordinates.isSuccessful()) {
    print('Coordinates ${coordinates.data()?.toJson()}');
  } else {
    var error = coordinates.error();

    if (error == What3WordsError.BAD_WORDS) {
      // The three word address provided is invalid
      print('BadWords: ${error!.message}');
    } else if (error == What3WordsError.INTERNAL_SERVER_ERROR) {
      // Server Error
      print('InternalServerError: ${error!.message}');
    } else if (error == What3WordsError.NETWORK_ERROR) {
      // Network Error
      print('NetworkError: ${error!.message}');
    } else {
      print('${error!.code} : ${error.message}');
    }
  }
}
10
likes
0
pub points
91%
popularity

Publisher

verified publisherwhat3words.com

A Dart library to use the what3words v3 API. This library can either be used in native Dart or Flutter applications

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

chopper, os_detect

More

Packages that depend on what3words