wear 0.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 68

Flutter Wear Plugin #

A collection of widgets for developing Wear OS (Android Wear) apps in Flutter.

Widgets #

There currently three widgets provided by the plugin:

  • WatchShape: determines whether the watch is square or round.
  • InheritedShape: an InheritedWidget that can be used to pass the shape of the watch down the widget tree.
  • AmbientMode: builder that provides what mode the watch is in. The widget will rebuild whenever the watch changes mode.

Example #

Typically all three of these widgets would be used near the root of your app's widget tree:

class WatchScreen extends StatelessWidget {
  Widget build(BuildContext context) => WatchShape(
      builder: (context, shape) => InheritedShape(
          shape: shape,
          child: AmbientMode(
            builder: (context, mode) =>
                mode == Mode.active ? ActiveWatchFace() : AmbientWatchFace(),

Requirements #

App Gradle File #

Change the min SDK version to API 23:

minSdkVersion 23

Then, add the following dependencies to the Android Gradle file for the app:

dependencies {
    // Wear libraries
    implementation 'com.android.support:wear:27.1.1'
    implementation 'com.google.android.support:wearable:2.3.0'
    compileOnly 'com.google.android.wearable:wearable:2.3.0'

Manifest File #

Add the following to your AndroidManifest.xml file:

<!-- Required for ambient mode support -->
<uses-permission android:name="android.permission.WAKE_LOCK" />

<!-- Flags the app as a Wear app -->
<uses-feature android:name="android.hardware.type.watch" />

<!-- Flags that the app doesn't require a companion phone app -->
    android:value="true" />

Update Android's MainActivity #

The ambient mode widget needs some initialization in Android's MainActivity code. Update your code as follows:

class MainActivity: FlutterActivity(), AmbientMode.AmbientCallbackProvider {
  override fun onCreate(savedInstanceState: Bundle?) {

    // Wire up the activity for ambient callbacks

  override fun getAmbientCallback(): AmbientMode.AmbientCallback {
    return FlutterAmbientCallback(getChannel(flutterView))

[0.0.1] - TODO: Add release date. #

  • TODO: Describe initial release.


import 'package:flutter/material.dart';
import 'package:wear/wear.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: WatchShape(
              builder: (context, shape) => Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: <Widget>[
                        'Shape: ${shape == Shape.round ? 'round' : 'square'}',
                          builder: (context, mode) => Text(
                                'Mode: ${mode == Mode.active ? 'Active' : 'Ambient'}',

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  wear: ^0.0.3

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:wear/wear.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 8, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Fix lib/wear.dart. (-1 points)

Analysis of lib/wear.dart reported 2 hints:

line 32 col 20: 'inheritFromWidgetOfExactType' is deprecated and shouldn't be used. Use dependOnInheritedWidgetOfExactType instead. This feature was deprecated after v1.12.1..

line 118 col 35: This function has a return type of 'Future', but doesn't end with a return statement.

Maintenance suggestions

Package is getting outdated. (-35.34 points)

The package was last published 70 weeks ago.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

The package description is too short. (-10 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
meta ^1.1.6 1.1.8
Transitive dependencies
collection 1.14.11 1.14.12
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8