- Published
- Author
- Satya
slack events api performs the events within 3 seconds if any exception happens then it retries again when the app is mentioned again.
At Codemancers, we believe every day is an opportunity to grow. This section is where our team shares bite-sized discoveries, technical breakthroughs and fascinating nuggets of wisdom we've stumbled upon in our work.
metadata provides additional information about the code. It begins with the character @ followed by either a reference to a compile-time constant or a call to a constant constructor.@Deprecated: This is used to indicate that a feature/method/class is deprecated and should not be used because it will be removed in future versions.@deprecated: This is similar to @Deprecated, with the difference being that a message can be passed with @Deprecated.@override: This is used to indicate that a method is intended to override a method from a superclass.@pragma: This is used to provide additional information to the Dart compiler.groupBy method introduced in ES12 can be used to group elements based on the values returned by the specified callback function. This can be useful when we want to categorize items into distinct groups.const transactions = [
{ account: 'savings', amount: 12, date: '2023-01-01' },
{ account: 'checking', amount: 200, date: '2023-01-01' },
{ account: 'savings', amount: 500, date: '2023-02-01' },
{ account: 'checking', amount: 300, date: '2023-02-01' },
];groupBy to group these transactions by their account type:const groupedTransactions = Object.groupBy(transactions, ({ account }) => account);{
savings: [
{ account: 'savings', amount: 12, date: '2023-01-01' },
{ account: 'savings', amount: 500, date: '2023-02-01' }
],
checking: [
{ account: 'checking', amount: 200, date: '2023-01-01' },
{ account: 'checking', amount: 300, date: '2023-02-01' }
]
}git log --branches --not --remotessetState() which also triggers a rebuild of the widget and its subtree. They can also rebuild when their parent widget or the widget hierarchy above them rebuilds.dynamic : dynamic is incredibly flexible. It tells Dart compiler to skip the type checking at compile time while type checking happens at run time. This is helpful when working with data of uncertain types.dynamic value = 42;
value = 'Sujay';
print(value.isEven); // Error thrown during runtimeObject : Object is the root class for all other classes. Its like a container like that can hold any value. Since Object is generic, you won't have access to specific methods or properties of value without type castingObject value = 42;
print(value.isEven); // throws compile time errordotenv config gets the job done. Alternate approach is to have values in package.json that goes against the idea of having the environment variables as secrets and hidden from the repository code.conditionally call a hook which fetches data.react-query and if you do not want to create a wrapper component to fetch the data, react-query provides a good solution. react-query has an enabled option for its useQuery hook. We can conditionally enable or disable the query based on our needs.const { data, isLoading } = useQuery(
['user', userId],
fetchUserData,
{ enabled: isAuthenticated }
);useQuery is only executed if isAuthenticated is true. If isAuthenticated is false, the query is skipped.flutter:
assets:
- .env (path to the file where env is stored)void main() async {
await dotenv.load();
runApp(const MyApp());
}dotenv.env['APP_ENVIRONMENT']Showing 36 to 38 of 82 results
Codemancers can bring your vision to life and help you achieve your goals