Skip to content

Commit ffdceb2

Browse files
chore: move existing annotations into seperate package
Co-authored-by: MasterMarcoHD <MasterMarcoHD@users.noreply.github.com>
0 parents  commit ffdceb2

File tree

10 files changed

+167
-0
lines changed

10 files changed

+167
-0
lines changed

.fvmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"flutter": "stable"
3+
}

.github/workflows/linting.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Linting
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
name: Lint Check
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: 📚 Checkout code
18+
uses: actions/checkout@v3
19+
20+
- name: 🐦 Set up Dart
21+
uses: dart-lang/setup-dart@v1
22+
with:
23+
sdk: stable
24+
25+
- name: 📦 Install dependencies
26+
run: dart pub get
27+
28+
- name: 🔍 Dart Analyze
29+
uses: ValentinVignal/action-dart-analyze@v0.17
30+
with:
31+
fail-on: format

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# https://dart.dev/guides/libraries/private-files
2+
# Created by `dart pub`
3+
.dart_tool/
4+
5+
# Avoid committing pubspec.lock for library packages; see
6+
# https://dart.dev/guides/libraries/private-files#pubspeclock.
7+
pubspec.lock
8+
9+
# FVM Version Cache
10+
.fvm/

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"dart.flutterSdkPath": ".fvm/versions/stable"
3+
}

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 1.0.0
2+
3+
- Initial version.

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!--
2+
This README describes the package. If you publish this package to pub.dev,
3+
this README's contents appear on the landing page for your package.
4+
5+
For information about how to write a good package README, see the guide for
6+
[writing package pages](https://dart.dev/tools/pub/writing-package-pages).
7+
8+
For general information about developing packages, see the Dart guide for
9+
[creating packages](https://dart.dev/guides/libraries/create-packages)
10+
and the Flutter guide for
11+
[developing packages and plugins](https://flutter.dev/to/develop-packages).
12+
-->
13+
14+
TODO: Put a short description of the package here that helps potential users
15+
know whether this package might be useful for them.
16+
17+
## Features
18+
19+
TODO: List what your package can do. Maybe include images, gifs, or videos.
20+
21+
## Getting started
22+
23+
TODO: List prerequisites and provide or point to information on how to
24+
start using the package.
25+
26+
## Usage
27+
28+
TODO: Include short and useful examples for package users. Add longer examples
29+
to `/example` folder.
30+
31+
```dart
32+
const like = 'sample';
33+
```
34+
35+
## Additional information
36+
37+
TODO: Tell users more about the package: where to find more information, how to
38+
contribute to the package, how to file issues, what response they can expect
39+
from the package authors, and more.

analysis_options.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This file configures the static analysis results for your project (errors,
2+
# warnings, and lints).
3+
#
4+
# This enables the 'recommended' set of lints from `package:lints`.
5+
# This set helps identify many issues that may lead to problems when running
6+
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
7+
# style and format.
8+
#
9+
# If you want a smaller set of lints you can change this to specify
10+
# 'package:lints/core.yaml'. These are just the most critical lints
11+
# (the recommended set includes the core lints).
12+
# The core lints are also what is used by pub.dev for scoring packages.
13+
14+
include: package:lints/recommended.yaml
15+
16+
# Uncomment the following section to specify additional rules.
17+
18+
# linter:
19+
# rules:
20+
# - camel_case_types
21+
22+
# analyzer:
23+
# exclude:
24+
# - path/to/excluded/files/**
25+
26+
# For more information about the core and recommended set of lints, see
27+
# https://dart.dev/go/core-lints
28+
29+
# For additional information about configuring this file, see
30+
# https://dart.dev/guides/language/analysis-options

lib/grumpy_annotations.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export 'src/must_call_in_constructor.dart';
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import 'package:meta/meta.dart';
2+
import 'package:meta/meta_meta.dart';
3+
4+
/// {@template hook_installer}
5+
/// An annotation indicating that the annotated method
6+
/// must be called in the constructor of the class
7+
/// that uses the mixin defining the method.
8+
///
9+
/// If [concreteOnly] is true (default), the requirement
10+
/// applies only to concrete classes, and calling it in an abstract
11+
/// class's constructor is considered a violation.
12+
/// Otherwise, it applies to the class even if it's abstract.
13+
///
14+
/// Note: If any class in the inheritance chain calls the
15+
/// annotated method in its constructor, the requirement
16+
/// is considered satisfied for subclasses.
17+
/// {@endtemplate}
18+
@Target({TargetKind.method})
19+
@immutable
20+
class MustCallInConstructor {
21+
/// If true (default), the requirement
22+
/// applies only to concrete classes, and calling it in an abstract
23+
/// class's constructor is considered a violation.
24+
/// Otherwise, it applies to the class even if it's abstract.
25+
final bool concreteOnly;
26+
27+
/// {@macro hook_installer}
28+
const MustCallInConstructor({this.concreteOnly = true});
29+
}
30+
31+
/// {@macro hook_installer}
32+
const mustCallInConstructor = MustCallInConstructor();

pubspec.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: grumpy_annotations
2+
description: A starting point for Dart libraries or applications.
3+
version: 1.0.0
4+
# repository: https://github.com/my_org/my_repo
5+
6+
environment:
7+
sdk: ^3.9.2
8+
9+
# Add regular dependencies here.
10+
dependencies:
11+
meta: ^1.8.0
12+
13+
dev_dependencies:
14+
lints: ^6.0.0
15+
test: ^1.25.6

0 commit comments

Comments
 (0)