You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To Reproduce
Checkout this repo
Go to counter sample
paste this code
import'package:flutter/material.dart';
import'package:flutter_riverpod/flutter_riverpod.dart';
import'package:riverpod_annotation/riverpod_annotation.dart';
part'main.g.dart';
// A Counter example implemented with riverpodvoidmain() {
runApp(
// Adding ProviderScope enables Riverpod for the entire projectconstProviderScope(child:MyApp()),
);
}
classMyAppextendsStatelessWidget {
constMyApp({super.key});
@overrideWidgetbuild(BuildContext context) {
returnMaterialApp(home:Home());
}
}
/// Annotating a class by `@riverpod` defines a new shared state for your application,/// accessible using the generated [counterProvider]./// This class is both responsible for initializing the state (through the [build] method)/// and exposing ways to modify it (cf [increment]).@riverpod@Deprecated('asdfasdf')
classCounterextends_$Counter {
/// Classes annotated by `@riverpod` **must** define a [build] function. /// This function is expected to return the initial state of your shared state. /// It is totally acceptable for this function to return a [Future] or [Stream] if you need to. /// You can also freely define parameters on this method.@overrideintbuild() =>0;
voidincrement() => state++;
}
@riverpod@Deprecated('Deprecation message')
@visibleForTesting@protectedStringfunctional(FunctionalRef ref) =>'functional';
@riverpod@Deprecated('Deprecation message')
@visibleForTesting@protectedclassClassBasedextends_$ClassBased {
@overrideStringbuild() =>'ClassBased';
}
@riverpod@Deprecated('Deprecation message')
@visibleForTesting@protectedStringfamily(FamilyRef ref, int id) =>'family $id';
classHomeextendsConsumerWidget {
@overrideWidgetbuild(BuildContext context, WidgetRef ref) {
returnScaffold(
appBar:AppBar(title:constText('Counter example')),
body:Center(
child:Text('${ref.watch(counterProvider)}'),
),
floatingActionButton:FloatingActionButton(
// The read method is a utility to read a provider without listening to it
onPressed: () => ref.read(counterProvider.notifier).increment(),
child:constIcon(Icons.add),
),
);
}
}
output
// GENERATED CODE - DO NOT MODIFY BY HANDpart of'main.dart';
// **************************************************************************// RiverpodGenerator// **************************************************************************String_$functionalHash() =>r'69e260b1de8ba28cbeb8e24d628933366cde6b8b';
/// See also [functional].@ProviderFor(functional)
final functionalProvider =AutoDisposeProvider<String>.internal(
functional,
name:r'functionalProvider',
debugGetCreateSourceHash:constbool.fromEnvironment('dart.vm.product') ?null: _$functionalHash,
dependencies:null,
allTransitiveDependencies:null,
);
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_elementtypedefFunctionalRef=AutoDisposeProviderRef<String>;
String_$familyHash() =>r'd70685b83be840bfd9e79c11fb84c905d19d6e10';
/// Copied from Dart SDKclass_SystemHash {
_SystemHash._();
staticintcombine(int hash, int value) {
// ignore: parameter_assignments
hash =0x1fffffff& (hash + value);
// ignore: parameter_assignments
hash =0x1fffffff& (hash + ((0x0007ffff& hash) <<10));
return hash ^ (hash >>6);
}
staticintfinish(int hash) {
// ignore: parameter_assignments
hash =0x1fffffff& (hash + ((0x03ffffff& hash) <<3));
// ignore: parameter_assignments
hash = hash ^ (hash >>11);
return0x1fffffff& (hash + ((0x00003fff& hash) <<15));
}
}
/// See also [family].@ProviderFor(family)
const familyProvider =FamilyFamily();
/// See also [family].classFamilyFamilyextendsFamily<String> {
/// See also [family].constFamilyFamily();
/// See also [family].FamilyProvidercall(
int id,
) {
returnFamilyProvider(
id,
);
}
@overrideFamilyProvidergetProviderOverride(
covariantFamilyProvider provider,
) {
returncall(
provider.id,
);
}
staticconstIterable<ProviderOrFamily>? _dependencies =null;
@overrideIterable<ProviderOrFamily>?get dependencies => _dependencies;
staticconstIterable<ProviderOrFamily>? _allTransitiveDependencies =null;
@overrideIterable<ProviderOrFamily>?get allTransitiveDependencies =>
_allTransitiveDependencies;
@overrideString?get name =>r'familyProvider';
}
/// See also [family].classFamilyProviderextendsAutoDisposeProvider<String> {
/// See also [family].FamilyProvider(
int id,
) :this._internal(
(ref) =>family(
ref asFamilyRef,
id,
),
from: familyProvider,
name:r'familyProvider',
debugGetCreateSourceHash:constbool.fromEnvironment('dart.vm.product')
?null: _$familyHash,
dependencies:FamilyFamily._dependencies,
allTransitiveDependencies:FamilyFamily._allTransitiveDependencies,
id: id,
);
FamilyProvider._internal(
super._createNotifier, {
requiredsuper.name,
requiredsuper.dependencies,
requiredsuper.allTransitiveDependencies,
requiredsuper.debugGetCreateSourceHash,
requiredsuper.from,
requiredthis.id,
}) :super.internal();
finalint id;
@overrideOverrideoverrideWith(
StringFunction(FamilyRef provider) create,
) {
returnProviderOverride(
origin:this,
override:FamilyProvider._internal(
(ref) =>create(ref asFamilyRef),
from: from,
name:null,
dependencies:null,
allTransitiveDependencies:null,
debugGetCreateSourceHash:null,
id: id,
),
);
}
@overrideAutoDisposeProviderElement<String> createElement() {
return_FamilyProviderElement(this);
}
@overridebooloperator==(Object other) {
return other isFamilyProvider&& other.id == id;
}
@overrideintget hashCode {
var hash =_SystemHash.combine(0, runtimeType.hashCode);
hash =_SystemHash.combine(hash, id.hashCode);
return_SystemHash.finish(hash);
}
}
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_elementmixinFamilyRefonAutoDisposeProviderRef<String> {
/// The parameter `id` of this provider.intget id;
}
class_FamilyProviderElementextendsAutoDisposeProviderElement<String>
withFamilyRef {
_FamilyProviderElement(super.provider);
@overrideintget id => (origin asFamilyProvider).id;
}
String_$counterHash() =>r'2052b20a37e1d8472ed76f852ad0331d9cffad00';
/// Annotating a class by `@riverpod` defines a new shared state for your application,/// accessible using the generated [counterProvider]./// This class is both responsible for initializing the state (through the [build] method)/// and exposing ways to modify it (cf [increment]).////// Copied from [Counter].@ProviderFor(Counter)
final counterProvider =AutoDisposeNotifierProvider<Counter, int>.internal(
Counter.new,
name:r'counterProvider',
debugGetCreateSourceHash:constbool.fromEnvironment('dart.vm.product') ?null: _$counterHash,
dependencies:null,
allTransitiveDependencies:null,
);
typedef_$Counter=AutoDisposeNotifier<int>;
String_$classBasedHash() =>r'f40d1a032ee264aafd7686a985cdf1937f2dc108';
/// See also [ClassBased].@ProviderFor(ClassBased)
final classBasedProvider =AutoDisposeNotifierProvider<ClassBased, String>.internal(
ClassBased.new,
name:r'classBasedProvider',
debugGetCreateSourceHash:constbool.fromEnvironment('dart.vm.product') ?null: _$classBasedHash,
dependencies:null,
allTransitiveDependencies:null,
);
typedef_$ClassBased=AutoDisposeNotifier<String>;
// ignore_for_file: type=lint// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
Expected behavior
Deprecations are passes to the corresponding providers
The text was updated successfully, but these errors were encountered:
Describe the bug
Despite this PR https://github.com/rrousselGit/riverpod/pull/2910/files
The deprecation does not passed
To Reproduce
Checkout this repo
Go to
counter
samplepaste this code
output
Expected behavior
Deprecations are passes to the corresponding providers
The text was updated successfully, but these errors were encountered: