MethodScope,flutter插件播放音乐

本文介绍了Flutter插件MethodScope的使用方法,包括创建自定义注解、多重范围、带有返回类型和参数的方法。同时,文章分享了学习资源,提供了一套系统的大厂面试题和Android学习资料,适合于技术提升和职业发展规划。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Usage


@MethodScope

Create a custom scope annotation using @MethodScope annotation.

@MethodScope

public @interface MyScope {

}

Here is the kotlin code example.

@MethodScope

annotation class MyScope

Attach the custom scope annotation on top of a class.

All of the public methods are the base method for the scoped like the init() method.

And designate scoping method using @Scoped annotation with the naming rule what startWith the base method’s name.

@MyScope

public class MyClass {

private String scope;

public void init() { // this is the base method of the scoped methods.

this.scope = “initialized”;

}

@Scoped(MyScope.class)

public void initMyScope() { // this is a scoped method for @MyScope.

this.scope = “initialized by @MyScope”;

}

}

After build the project, MyClass_MyScope class will be auto-generated.

MyClass_MyScope myClass_myScope = new MyClass_MyScope();

myClass_myScope.init(); // calls init() and initMyScope() methods.

myClass_myScope.initMyScope(); // calls only initMyScope() method.

Multiple Scoping

Here is how to create multiple scoped class.

@MyScope

@HisScope

@YourScope

public class MyClass {

private String scope;

public void init() { // this is the base method of the scoped methods.

this.scope = “initialized”;

}

@Scoped(MyScope.class)

public void initMyScope() { // this is a scoped method for @MyScope.

this.scope = “initialized by @MyScope”;

}

@Scoped(YourScope.class)

public void initMineScopeNotYours() { // this is a scoped method for @YourScope.

this.scope = “initialized by @YourScope”;

}

}

After build the project, MyClass_MyScopeMyClass_HisScopeMyClass_YourScope classes will be auto-generated.

Scoping with a return type and parameters

Methods that have a return type and parameters can be scoped method.

The base method’s return type and parameters are must be the same as the scoped method’s one.

@MyScope

abstract public class MyClass {

private String scope;

public String init(String text) { // this is the base method of the scoped methods.

this.scope += text;

return this.scope;

}

学习分享

在当下这个信息共享的时代,很多资源都可以在网络上找到,只取决于你愿不愿意找或是找的方法对不对了

很多朋友不是没有资料,大多都是有几十上百个G,但是杂乱无章,不知道怎么看从哪看起,甚至是看后就忘

如果大家觉得自己在网上找的资料非常杂乱、不成体系的话,我也分享一套给大家,比较系统,我平常自己也会经常研读。

2021最新上万页的大厂面试真题

七大模块学习资料:如NDK模块开发、Android框架体系架构…

只有系统,有方向的学习,才能在段时间内迅速提高自己的技术。

这份体系学习笔记,适应人群:
**第一,**学习知识比较碎片化,没有合理的学习路线与进阶方向。
**第二,**开发几年,不知道如何进阶更进一步,比较迷茫。
**第三,**到了合适的年纪,后续不知道该如何发展,转型管理,还是加强技术研究。如果你有需要,我这里恰好有为什么,不来领取!说不定能改变你现在的状态呢!

由于文章内容比较多,篇幅不允许,部分未展示内容以截图方式展示 。如有需要获取完整的资料文档的朋友点击我的【GitHub】免费获取。

文档的朋友点击我的【GitHub】免费获取。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值