Skip to content

Commit

Permalink
Merge pull request #2 from MadBrains/release_1_0_1
Browse files Browse the repository at this point in the history
Release 1.0.1
  • Loading branch information
kishkihihi authored Oct 29, 2024
2 parents bcacf7f + 24a090f commit 3f7492b
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 254 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.0.1

- **DOCS**: Provided documentation for `GravitySensor` and `GravitySensorPlatform`.
- **CHORE**: Updated `flutter_lints` to `^5.0.0`.
- **FEAT**: gravityEvents now can throw `FormatException` if the event format is invalid.

## 1.0.0

* Initial release.
235 changes: 0 additions & 235 deletions example/lib/src/coordinate_system_painter.dart

This file was deleted.

6 changes: 3 additions & 3 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.0.0"
version: "1.0.1"
integration_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -279,5 +279,5 @@ packages:
source: hosted
version: "3.0.3"
sdks:
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
dart: ">=3.0.0 <4.0.0"
flutter: ">=3.10.0"
3 changes: 2 additions & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ description: "Demonstrates how to use the gravity_sensor plugin."
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

environment:
sdk: '>=3.2.0 <4.0.0'
sdk: '>=3.0.0 <4.0.0'
flutter: '>=3.10.0'

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
Expand Down
6 changes: 4 additions & 2 deletions lib/gravity_sensor.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'gravity_sensor_platform_interface.dart';
import 'src/gravity_sensor_platform_interface.dart';
import 'src/models/gravity_event.dart';

export 'src/gravity_event.dart';
export 'src/models/gravity_event.dart';

/// API for accessing information from gravity sensor of the device.
class GravitySensor extends GravitySensorPlatform {
GravitySensor._();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/services.dart';

import 'gravity_sensor_platform_interface.dart';
import 'models/gravity_event.dart';

/// An implementation of [GravitySensorPlatform] that uses method channels.
class MethodChannelGravitySensor extends GravitySensorPlatform {
Expand All @@ -10,13 +11,19 @@ class MethodChannelGravitySensor extends GravitySensorPlatform {

@override
Stream<GravityEvent> get gravityEvents {
return _gravityEvents ??= _gravityEventChannel.receiveBroadcastStream().map((dynamic event) {
final list = event.cast<double>();
return GravityEvent(
list[0]!,
list[1]!,
list[2]!,
);
});
return _gravityEvents ??= _gravityEventChannel.receiveBroadcastStream().map(
(dynamic event) {
if (event is! List<Object?> || event.length < 3) {
throw FormatException('Invalid event format');
}
final list = event.cast<double>();

return GravityEvent(
list[0],
list[1],
list[2],
);
},
);
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

import 'gravity_sensor_method_channel.dart';
import 'src/gravity_event.dart';

export 'src/gravity_event.dart';
import 'models/gravity_event.dart';

/// The common platform interface for gravity sensor.
abstract class GravitySensorPlatform extends PlatformInterface {
/// Constructs a GravitySensorPlatform.
GravitySensorPlatform() : super(token: _token);
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: gravity_sensor
version: 1.0.0
version: 1.0.1
description: Flutter plugin to access the gravity sensor of the device.
homepage: https://madbrains.ru/
repository: https://github.com/MadBrains/Gravity-Sensor-Flutter
Expand All @@ -18,7 +18,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^3.0.1
flutter_lints: ^5.0.0

flutter:
plugin:
Expand Down

0 comments on commit 3f7492b

Please sign in to comment.