Skip to content

Commit

Permalink
Prep 1.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
robrbecker committed Mar 8, 2021
1 parent 4efdf57 commit 834054b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 173 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest

container:
image: google/dart:2.12-dev
image: google/dart:2.12

steps:
- uses: actions/checkout@v1
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.0

- Stable release w/ null safety for Dart 2.12+

## 1.1.0-nullsafety.1

- fix pub score and tweak pub details
Expand Down
163 changes: 1 addition & 162 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,162 +1 @@
analyzer:

# ALL lint rules are included and the ones not in use are commented
# out with a reason. An up to date list of all options is here
# http://dart-lang.github.io/linter/lints/options/options.html
# Descriptions of each rule is here http://dart-lang.github.io/linter/lints/
#
# To ignore a lint rule on a case by case basic in code just add a comment
# above it like so: // ignore: <linter rule>
# example: // ignore: invalid_assignment, const_initialized_with_non_constant_value
#
# More info about config lint config options is here
# https://www.dartlang.org/guides/language/analysis-options#excluding-lines-within-a-file
linter:
rules:
# Style: Declare method return types.
# override with // ignore: always_declare_return_types
- always_declare_return_types

# Style: Specify type annotations.
- always_specify_types # really annoying for local vars

# Style: Annotate overridden members
- annotate_overrides

# Style: Avoid using as.
- avoid_as

# Error: Avoid empty else statements.
- avoid_empty_else

# Style: Don't explicitly initialize variables to null
- avoid_init_to_null

# Style: Avoid return types on setters.
- avoid_return_types_on_setters

# Style: Await only futures.
- await_only_futures

# Style: Name types using UpperCamelCase.
- camel_case_types

# Error: Cancel instances of dart.async.StreamSubscription.
- cancel_subscriptions

# Error: Close instances of dart.core.Sink.
- close_sinks

# Error: Only reference in scope identifiers in doc comments.
- comment_references

# Style: Prefer using lowerCamelCase for constant names.
- constant_identifier_names

# Error: Avoid control flow in finally block.
- control_flow_in_finally

# Style: Avoid empty catch blocks.
- empty_catches

# Style: Use ; instead of {} for empty constructor bodies.
- empty_constructor_bodies

# Error: Avoid empty statements.
- empty_statements

# Error: Always override hashCode if overriding ==
- hash_and_equals

# Style: Don't import implementation files from another package.
- implementation_imports

# Error: Conditions should not unconditionally evaluate to "TRUE" or to "FALSE"
- invariant_booleans

# Error: Invocation of Iterable.contains with references of unrelated types.
- iterable_contains_unrelated_type

# Style: Name libraries and source files using lowercase_with_underscores.
- library_names

# Style: Use lowercase_with_underscores when specifying a library prefix.
- library_prefixes

# Error: Invocation of List.remove with references of unrelated types.
- list_remove_unrelated_type

# Error: Conditions should not unconditionally evaluate to "TRUE" or to "FALSE"
- literal_only_boolean_expressions

# Style: Name non-constant identifiers using lowerCamelCase.
- non_constant_identifier_names # UiFactories will lint

# Style: Avoid defining a one-member abstract class when a simple function will do.
- one_member_abstracts

# Style: Only throw instances of classes extending either Exception or Error
- only_throw_errors

# Style: Do not override fields.
- overridden_fields

# Style: Provide doc comments for all public APIs
- package_api_docs

# Pub: Use lowercase_with_underscores for package names.
- package_names

# Style: Prefix library names with the package name and a dot-separated path.
- package_prefixed_library_names

# Style: Don't reassign references to parameters of functions or methods.
- parameter_assignments

# Style: Private field could be final.
- prefer_final_fields

# Style: Prefer final for variable declaration if reference is not reassigned.
# - prefer_final_locals # Noisy, people use var a lot

# Style: Use isNotEmpty for Iterables and Maps.
- prefer_is_not_empty

# Style: Document all public members
- public_member_api_docs

# Style: Prefer to use /// for doc comments
- slash_for_doc_comments

# Style: Sort constructor declarations before method declarations.
- sort_constructors_first

# Style: Sort unnamed constructor declarations first
- sort_unnamed_constructors_first

# Error: Test type arguments in operator ==(Object other).
- test_types_in_equals

# Error: Avoid throw in finally block.
- throw_in_finally

# Style: Type annotate public APIs.
- type_annotate_public_apis # render can return either ReactElement or false

# Style: Don't type annotate initializing formals.
- type_init_formals

# Style: Await for future expression statements inside async function bodies.
- unawaited_futures

# Style: Avoid using braces in interpolation when not needed.
# - unnecessary_brace_in_string_interp # preference

# Style: Avoid wrapping fields in getters and setters just to be "safe".
- unnecessary_getters_setters

# Error: Equality operator (==) invocation with references of unrelated types.
- unrelated_type_equality_checks

# Error: Use valid regular expression syntax.
- valid_regexps
include: package:pedantic/analysis_options.yaml
4 changes: 2 additions & 2 deletions example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import 'package:resize_observer/resize_observer.dart' as ro;
bool observing = true;

Future<void> main() async {
Element textarea = document.getElementById('textarea')!;
Element obsEl = document.getElementById('observing')!;
final textarea = document.getElementById('textarea')!;
final obsEl = document.getElementById('observing')!;

ro.ResizeObserver.observe(textarea, _onResize);
obsEl.innerHtml = observing.toString();
Expand Down
9 changes: 4 additions & 5 deletions lib/resize_observer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import 'dart:html';
import 'dart:js';

/// A callback for ResizeObserver must conform to this signature
typedef void ResizeObserverCallback(Element element, num x, num y, num width,
num height, num top, num bottom, num left, num right);
typedef ResizeObserverCallback = void Function(Element element, num x, num y,
num width, num height, num top, num bottom, num left, num right);

/// Resize Observer
abstract class ResizeObserver {
Expand All @@ -17,8 +17,7 @@ abstract class ResizeObserver {

static JsObject? _initResizeObserver() {
if (supported) {
return JsObject(
context['ResizeObserver'], <dynamic>[_dispatchResizes]);
return JsObject(context['ResizeObserver'], <dynamic>[_dispatchResizes]);
}
return null;
}
Expand All @@ -34,7 +33,7 @@ abstract class ResizeObserver {
return;
}

ResizeObserverCallback? callback = _callbackMap[target!];
var callback = _callbackMap[target!];
if (callback != null) {
JsObject? rect = entry['contentRect'];
if (rect != null) {
Expand Down
7 changes: 4 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: resize_observer
version: 1.1.0-nullsafety.1
description: A Dart wrapper for the ResizeObserver API
version: 1.1.0
description: A Dart wrapper for the ResizeObserver API that uses JS interop and a single observer
homepage: https://github.com/robrbecker/resize_observer

environment:
sdk: '>=2.12.0-0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'

dev_dependencies:
pedantic:
build_runner:
build_web_compilers:

0 comments on commit 834054b

Please sign in to comment.