The Atsign FoundationThe Atsign Foundation

pub package gitHub license

Overview

The at_location_flutter package is for Flutter developers who want to implement location feature in their apps. This package provides the feature to share and receive location between two atsigns.

This open source package is written in Dart, supports Flutter and follows the atPlatform's decentralized, edge computing model with the following features:

  • Cryptographic control of data access through personal data stores
  • No application backend needed
  • End to end encryption where only the data owner has the keys
  • Private and surveillance free connectivity
  • Share locations and view them on map

We call giving people control of access to their data “flipping the internet” and you can learn more about how it works by reading this overview.

Get Started:

There are three options to get started using this package.

1. Quick start - generate a skeleton app with at_app

This package includes a working sample application in the Example directory that you can use to create a personalized copy using at_app create in four commands.

$ flutter pub global activate at_app 
$ at_app create --sample=<package ID> <app name> 
$ cd <app name>
$ flutter run

Notes:

  1. You only need to run flutter pub global activate once
  2. Use at_app.bat for Windows

2. Clone it from GitHub

Feel free to fork a copy of the source from the GitHub repo. The example code contained there is the same as the template that is used by at_app above.

$ git clone https://github.com/atsign-foundation/at_widgets.git

3. Manually add the package to a project

Instructions on how to manually add this package to you project can be found on pub.dev here.

How it works

Setup

Initialising:

It is expected that the app will first authenticate an atsign using the Onboarding widget.

The location service needs to be initialised with a required GlobalKey

await initializeLocationService(
      navKey,
      mapKey: 'xxxx',
      apiKey: 'xxxx',
      showDialogBox: true,
      streamAlternative: (__){},
      isEventInUse: true, 
    );

As this package needs location permission, so add these for:

IOS: (ios/Runner/Info.plist)

<key>NSLocationWhenInUseUsageDescription</key>
<string>Explain the description here.</string>

Android: (android/app/src/main/AndroidManifest.xml)

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

Usage

To share location with an atsign for 30 minutes:

sendShareLocationNotification(receiver, 30);

To request location from an atsign:

sendRequestLocationNotification(receiver);

To view location of atsigns:

AtLocationFlutterPlugin(
  ['atsign1', 'atsign2', ...]
)

To use the default map view:

Navigator.push(
      context,
      MaterialPageRoute(
          builder: (context) => MapScreen(
                currentAtSign: AtLocationNotificationListener().currentAtSign,
                userListenerKeyword: locationNotificationModel,
              )),
    );

To use the default home screen view:

Navigator.push(
      context,
      MaterialPageRoute(
        builder: (BuildContext context) => HomeScreen(),
    ));

Different datatypes used in the package:

 - LocationNotificationModel: Contains the details of a share/request location and is sent to atsigns while sharing / requesting.
 - LocationDataModel: Gets transferred in the background, contains the actual geo-coordinates and other details.
 - KeyLocationModel - The package uses this to keep a track of all the share/request notifications.

Steps to get mapKey

Steps to get apiKey

Example

We have a good example with explanation in the at_location_flutter package.

Open source usage and contributions

This is open source code, so feel free to use it as is, suggest changes or enhancements or create your own version. See CONTRIBUTING.md for detailed guidance on how to setup tools, tests and make a pull request.

Libraries

map_content/flutter_map_marker_cluster/src/anim_type
service/api_service
at_location_flutter
A library to provide location sharing functionality used by the at_protocol packages and apps
at_location_flutter_plugin
service/at_location_notification_listener
common_components/bottom_sheet
map_content/flutter_map/src/core/bounds
common_components/build_marker
map_content/flutter_map/src/core/center_zoom
map_content/flutter_map/src/layer/circle_layer
common_components/circle_marker_painter
common_components/collapsed_content
utils/constants/colors
common_components/confirmation_dialog
utils/constants/constants
service/contact_service
common_components/contacts_initial
This is a widget to display the initials of an atsign which does not have a profile picture it takes in @param size as a double and @param initials as String and display those initials in a circular avatar with random colors
map_content/flutter_map/src/geo/crs/crs
common_components/custom_circle_avatar
common_components/custom_popup_route
common_components/custom_toast
common_components/display_tile
service/distance_calculate
map_content/flutter_map_marker_cluster/src/core/distance_grid
common_components/draggable_symbol
common_components/floating_icon
map_content/flutter_map/flutter_map
map_content/flutter_map/src/map/flutter_map_state
map_content/flutter_map/src/gestures/gestures
map_content/flutter_map/src/layer/group_layer
screens/home/home_screen
service/home_screen_service
location_modal/hybrid_model
utils/constants/init_location_service
location_modal/key_location_model
service/key_stream_service
map_content/flutter_map/src/geo/latlng_bounds
map_content/flutter_map/src/gestures/latlng_tween
map_content/flutter_map/src/layer/layer
common_components/loading_widget
location_modal/location_data_model
location_modal/location_modal
location_modal/location_notification
common_components/location_prompt_dialog
service/location_service
map_content/flutter_map/src/map/map
screens/map_screen/map_screen
map_content/flutter_map/src/map/map_state_widget
common_components/marker_cluster
map_content/flutter_map_marker_cluster/src/marker_cluster_layer
map_content/flutter_map_marker_cluster/src/marker_cluster_layer_options
map_content/flutter_map_marker_cluster/src/node/marker_cluster_node
map_content/flutter_map_marker_cluster/src/marker_cluster_plugin
common_components/marker_custom_painter
map_content/flutter_map/src/layer/marker_layer
map_content/flutter_map_marker_cluster/src/node/marker_node
map_content/flutter_map_marker_popup/src/marker_popup
service/master_location_service
service/my_location
screens/notification_dialog/notification_dialog
service/notify_and_put
map_content/flutter_map/src/layer/overlay_image_layer
map_content/flutter_map/src/plugins/plugin
map_content/flutter_map/src/core/point
common_components/pointed_bottom
map_content/flutter_map/src/layer/polygon_layer
map_content/flutter_map/src/layer/polyline_layer
common_components/pop_button
map_content/flutter_map_marker_cluster/src/core/quick_hull
service/request_location_service
screens/request_location/request_location_sheet
service/search_location_service
service/send_location_notification
screens/share_location/share_location_sheet
service/sharing_location_service
show_location
map_content/flutter_map_marker_cluster/src/core/spiderfy
common_components/tasks
utils/constants/text_strings
utils/constants/text_styles
common_components/text_tile
common_components/text_tile_repeater
map_content/flutter_map/src/layer/tile_layer
map_content/flutter_map/src/layer/tile_provider/tile_provider
map_content/flutter_map/src/core/util