-
-
Notifications
You must be signed in to change notification settings - Fork 961
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📃 docs(zh-Hans/from_provider): translate doc
- Loading branch information
yang-lile
committed
Nov 18, 2023
1 parent
db7c693
commit 8fa84b8
Showing
33 changed files
with
2,344 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/from_provider/family/family.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'dart:math'; | ||
|
||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
|
||
part 'family.g.dart'; | ||
/* SNIPPET START */ | ||
|
||
@riverpod | ||
int random(RandomRef ref, {required int seed, required int max}) { | ||
return Random(seed).nextInt(max); | ||
} |
174 changes: 174 additions & 0 deletions
174
...te/i18n/zh-Hans/docusaurus-plugin-content-docs/current/from_provider/family/family.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/from_provider/family/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import raw from "!!raw-loader!./raw.dart"; | ||
import codegen from "!!raw-loader!./family.dart"; | ||
|
||
export default { | ||
raw, | ||
hooks: raw, | ||
codegen, | ||
hooksCodegen: codegen, | ||
}; |
27 changes: 27 additions & 0 deletions
27
website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/from_provider/family/raw.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'dart:math'; | ||
|
||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
|
||
@immutable | ||
abstract class Equatable { | ||
const Equatable(); | ||
|
||
List<Object?> get props; | ||
} | ||
|
||
/* SNIPPET START */ | ||
class ParamsType extends Equatable { | ||
const ParamsType({required this.seed, required this.max}); | ||
|
||
final int seed; | ||
final int max; | ||
|
||
@override | ||
List<Object?> get props => [seed, max]; | ||
} | ||
|
||
final randomProvider = | ||
Provider.family.autoDispose<int, ParamsType>((ref, params) { | ||
return Random(params.seed).nextInt(params.max); | ||
}); |
12 changes: 12 additions & 0 deletions
12
website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/from_provider/helpers/item.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
|
||
import 'json.dart'; | ||
|
||
part 'item.freezed.dart'; | ||
part 'item.g.dart'; | ||
|
||
@freezed | ||
class Item with _$Item { | ||
const factory Item({required int id}) = _Item; | ||
factory Item.fromJson(Json json) => _$ItemFromJson(json); | ||
} |
146 changes: 146 additions & 0 deletions
146
...8n/zh-Hans/docusaurus-plugin-content-docs/current/from_provider/helpers/item.freezed.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
// coverage:ignore-file | ||
// GENERATED CODE - DO NOT MODIFY BY HAND | ||
// ignore_for_file: type=lint | ||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark | ||
|
||
part of 'item.dart'; | ||
|
||
// ************************************************************************** | ||
// FreezedGenerator | ||
// ************************************************************************** | ||
|
||
T _$identity<T>(T value) => value; | ||
|
||
final _privateConstructorUsedError = UnsupportedError( | ||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); | ||
|
||
Item _$ItemFromJson(Map<String, dynamic> json) { | ||
return _Item.fromJson(json); | ||
} | ||
|
||
/// @nodoc | ||
mixin _$Item { | ||
int get id => throw _privateConstructorUsedError; | ||
|
||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError; | ||
@JsonKey(ignore: true) | ||
$ItemCopyWith<Item> get copyWith => throw _privateConstructorUsedError; | ||
} | ||
|
||
/// @nodoc | ||
abstract class $ItemCopyWith<$Res> { | ||
factory $ItemCopyWith(Item value, $Res Function(Item) then) = | ||
_$ItemCopyWithImpl<$Res, Item>; | ||
@useResult | ||
$Res call({int id}); | ||
} | ||
|
||
/// @nodoc | ||
class _$ItemCopyWithImpl<$Res, $Val extends Item> | ||
implements $ItemCopyWith<$Res> { | ||
_$ItemCopyWithImpl(this._value, this._then); | ||
|
||
// ignore: unused_field | ||
final $Val _value; | ||
// ignore: unused_field | ||
final $Res Function($Val) _then; | ||
|
||
@pragma('vm:prefer-inline') | ||
@override | ||
$Res call({ | ||
Object? id = null, | ||
}) { | ||
return _then(_value.copyWith( | ||
id: null == id | ||
? _value.id | ||
: id // ignore: cast_nullable_to_non_nullable | ||
as int, | ||
) as $Val); | ||
} | ||
} | ||
|
||
/// @nodoc | ||
abstract class _$$ItemImplCopyWith<$Res> implements $ItemCopyWith<$Res> { | ||
factory _$$ItemImplCopyWith( | ||
_$ItemImpl value, $Res Function(_$ItemImpl) then) = | ||
__$$ItemImplCopyWithImpl<$Res>; | ||
@override | ||
@useResult | ||
$Res call({int id}); | ||
} | ||
|
||
/// @nodoc | ||
class __$$ItemImplCopyWithImpl<$Res> | ||
extends _$ItemCopyWithImpl<$Res, _$ItemImpl> | ||
implements _$$ItemImplCopyWith<$Res> { | ||
__$$ItemImplCopyWithImpl(_$ItemImpl _value, $Res Function(_$ItemImpl) _then) | ||
: super(_value, _then); | ||
|
||
@pragma('vm:prefer-inline') | ||
@override | ||
$Res call({ | ||
Object? id = null, | ||
}) { | ||
return _then(_$ItemImpl( | ||
id: null == id | ||
? _value.id | ||
: id // ignore: cast_nullable_to_non_nullable | ||
as int, | ||
)); | ||
} | ||
} | ||
|
||
/// @nodoc | ||
@JsonSerializable() | ||
class _$ItemImpl implements _Item { | ||
const _$ItemImpl({required this.id}); | ||
|
||
factory _$ItemImpl.fromJson(Map<String, dynamic> json) => | ||
_$$ItemImplFromJson(json); | ||
|
||
@override | ||
final int id; | ||
|
||
@override | ||
String toString() { | ||
return 'Item(id: $id)'; | ||
} | ||
|
||
@override | ||
bool operator ==(dynamic other) { | ||
return identical(this, other) || | ||
(other.runtimeType == runtimeType && | ||
other is _$ItemImpl && | ||
(identical(other.id, id) || other.id == id)); | ||
} | ||
|
||
@JsonKey(ignore: true) | ||
@override | ||
int get hashCode => Object.hash(runtimeType, id); | ||
|
||
@JsonKey(ignore: true) | ||
@override | ||
@pragma('vm:prefer-inline') | ||
_$$ItemImplCopyWith<_$ItemImpl> get copyWith => | ||
__$$ItemImplCopyWithImpl<_$ItemImpl>(this, _$identity); | ||
|
||
@override | ||
Map<String, dynamic> toJson() { | ||
return _$$ItemImplToJson( | ||
this, | ||
); | ||
} | ||
} | ||
|
||
abstract class _Item implements Item { | ||
const factory _Item({required final int id}) = _$ItemImpl; | ||
|
||
factory _Item.fromJson(Map<String, dynamic> json) = _$ItemImpl.fromJson; | ||
|
||
@override | ||
int get id; | ||
@override | ||
@JsonKey(ignore: true) | ||
_$$ItemImplCopyWith<_$ItemImpl> get copyWith => | ||
throw _privateConstructorUsedError; | ||
} |
Oops, something went wrong.