Skip to content

Commit

Permalink
feat: updated for support Dart 2
Browse files Browse the repository at this point in the history
  • Loading branch information
tech-andgar committed Feb 6, 2024
1 parent 2d0e0cf commit 5b4dbfd
Show file tree
Hide file tree
Showing 10 changed files with 5,559 additions and 1,079 deletions.
19 changes: 18 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# See https://www.dartlang.org/guides/libraries/private-files
# Files and directories created by pub
.dart_tool/
.packages
.pub/
build/
Expand All @@ -14,4 +16,19 @@ doc/api/

# Coverage reports
coverage/
lcov.info
lcov.info

# dotenv environment variables file
.env*

# Avoid committing generated Javascript files:
*.dart.js
*.info.json # Produced by the --dump-info flag.
*.js # When generated by dart2js. Don't specify *.js if your
# project includes source files written in JavaScript.
*.js_
*.js.deps
*.js.map

.flutter-plugins
.flutter-plugins-dependencies
177 changes: 169 additions & 8 deletions README.md

Large diffs are not rendered by default.

34 changes: 23 additions & 11 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
include: package:lints/recommended.yaml

analyzer:
strong-mode: true
# exclude:
# - path/to/excluded/files/**
plugins:
- dart_code_linter
language:
strict-casts: true
strict-inference: true
strict-raw-types: true

# Lint rules and documentation, see http://dart-lang.github.io/linter/lints
linter:
rules:
- cancel_subscriptions
- close_sinks
- hash_and_equals
- iterable_contains_unrelated_type
- list_remove_unrelated_type
- test_types_in_equals
- unrelated_type_equality_checks
- valid_regexps
# - collection_methods_unrelated_type
- require_trailing_commas

dart_code_linter:
extends:
- package:dart_code_linter/presets/recommended.yaml
- package:dart_code_linter/presets/metrics_recommended.yaml

rules:
- prefer-correct-identifier-length:
exceptions: [ 'ok', 'Ok', 'OK' ]
exclude:
- test/**
- format-comment: false
- no-magic-number: false
19 changes: 16 additions & 3 deletions example/http_status_example.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
// Copyright (c) 2017, Era Productions. All rights reserved. Use of this source code
// Copyright (c) 2017, Era Productions.
// Copyright (c) 2024, TECH-ANDGAR.
// All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

// ignore_for_file: deprecated_member_use_from_same_package
// TODO: Remove this line `deprecated_member_use_from_same_package` in the next version (v3.0.0)
// Reason: Deprecated member use from same package violates the lint rule. Refactor it to comply with the Dart style guide

import 'package:http_status/http_status.dart';

main() {
print('${HttpStatusCode.OK}');
void main() {
print('${HttpStatusCode.ok}');
print('${HttpStatus.OK}');
// Note: 'Ok' is deprecated and shouldn't be used. Use [ok] instead.
print('${HttpStatus.ok}');
print('${HttpStatus.No_Content}');
// Note: 'NoContent' is deprecated and shouldn't be used.
// Use [noContent] instead.
print('${HttpStatusCode.noContent}');
print('${HttpStatus.fromCode(404)}');
}
5 changes: 4 additions & 1 deletion lib/http_status.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Copyright (c) 2017, andre. All rights reserved. Use of this source code
// Copyright (c) 2017, andre. All rights reserved.
// Copyright (c) 2024, TECH-ANDGAR. All rights reserved.
// Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

/// Http Status library.
library http_status;

export 'src/http_status_base.dart';
export 'src/http_status_code.dart';
Loading

0 comments on commit 5b4dbfd

Please sign in to comment.