Skip to content

Commit

Permalink
fix: add thecodehxub to cspell and fix docs in example
Browse files Browse the repository at this point in the history
  • Loading branch information
thisissandipp committed Jun 9, 2024
1 parent f4b5ff4 commit ef36ffd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
}
],
"useGitignore": true,
"words": ["request_validator", "Sandip", "Pramanik"]
"words": ["request_validator", "Sandip", "Pramanik", "thecodexhub"]
}
24 changes: 22 additions & 2 deletions example/lib/src/models/person.dart
Original file line number Diff line number Diff line change
@@ -1,36 +1,56 @@
// ignore_for_file: public_member_api_docs

import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:meta/meta.dart';

part 'person.g.dart';

/// Enum to represent gender
enum Gender {
/// Male
male,

/// Female
female,

/// Other
other;

/// Returns the string representation of the enum value
/// without the class prefix.
String get name => toString().split('.').last;
}

/// {@template person}
/// A class representing a person with basic information like
/// username, email, age, and gender.
/// {@endtemplate}
@immutable
@JsonSerializable()
class Person extends Equatable {
/// {@macro person}
const Person({
required this.username,
required this.email,
required this.age,
required this.gender,
});

/// Creates an instance of [Person] from [Map].
factory Person.fromJson(Map<String, dynamic> json) => _$PersonFromJson(json);

/// Username of the person.
final String username;

/// Email id of the person.
final String email;

/// Age of the person.
final int age;

/// Gender of the person
final Gender gender;

/// Converts [Person] object to a [Map] onject.
Map<String, dynamic> toJson() => _$PersonToJson(this);

@override
Expand Down

0 comments on commit ef36ffd

Please sign in to comment.