Skip to content

Commit 5cb289f

Browse files
Merge pull request #9 from contentstack/development
Development
2 parents 2c38bbd + 3360f5b commit 5cb289f

19 files changed

+1448
-1025
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ test/.test_coverage.dart/
1818
*.ipr
1919
*.iws
2020
.idea/
21+
.env*
2122

2223
# The .vscode folder contains launch configuration and tasks you configure in
2324
# VS Code which you may wish to be included in version control, so this line

.vscode/launch.json

+3-7
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7-
87
{
9-
"name": "Dart",
10-
"program": "bin/main.dart",
8+
"name": "contentstack-dart",
119
"request": "launch",
12-
"type": "dart",
13-
},
14-
15-
10+
"type": "dart"
11+
}
1612
]
1713
}

CHANGELOG.md

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1+
# CHANGELOG
12

2-
# [0.1.0] - Initial release
3-
4-
## May-11-2020 -initial release
5-
6-
### Initial release for the contentstack-dart-sdk for Content Delivery API
3+
## [0.1.1] - Publish content fallback
4+
##### Dec-08-2020
5+
#### New Features:
6+
[Entry] - Publish fallback method added
7+
[Query] - Publish fallback method added
8+
[Asset] - Publish fallback method added
9+
[Assets] - Publish fallback method added
710

811
-----------------------------
912

10-
# [0.0.1] - Beta release
13+
## [0.1.0] - Initial release
14+
##### __May-11-2020 -initial release__
15+
#### Initial release for the contentstack-dart-sdk for Content Delivery API
1116

12-
## May-08-2020 -beta release
13-
14-
### Beta release for the contentstack-dart-sdk for Content Delivery API
17+
-----------------------------
1518

19+
## [0.0.1] - Beta release
20+
##### **May-08-2020 -beta release**
21+
#### Beta release for the contentstack-dart-sdk for Content Delivery API
1622
-----------------------------

analysis_options.yaml

+89-87
Original file line numberDiff line numberDiff line change
@@ -8,90 +8,92 @@ errors:
88

99
linter:
1010
rules:
11-
- always_declare_return_types
12-
- annotate_overrides
13-
- avoid_bool_literals_in_conditional_expressions
14-
- avoid_classes_with_only_static_members
15-
- avoid_empty_else
16-
- avoid_function_literals_in_foreach_calls
17-
- avoid_init_to_null
18-
- avoid_null_checks_in_equality_operators
19-
- avoid_relative_lib_imports
20-
- avoid_renaming_method_parameters
21-
- avoid_return_types_on_setters
22-
- avoid_returning_null
23-
- avoid_returning_null_for_future
24-
- avoid_returning_null_for_void
25-
- avoid_returning_this
26-
- avoid_shadowing_type_parameters
27-
- avoid_single_cascade_in_expression_statements
28-
- avoid_types_as_parameter_names
29-
- avoid_unused_constructor_parameters
30-
- await_only_futures
31-
- camel_case_types
32-
#- prefer_void_to_null
33-
- cancel_subscriptions
34-
- cascade_invocations
35-
- comment_references
36-
- constant_identifier_names
37-
- control_flow_in_finally
38-
- directives_ordering
39-
- empty_catches
40-
- empty_constructor_bodies
41-
- empty_statements
42-
- file_names
43-
- hash_and_equals
44-
- implementation_imports
45-
- invariant_booleans
46-
- iterable_contains_unrelated_type
47-
- join_return_with_assignment
48-
- library_names
49-
- library_prefixes
50-
- list_remove_unrelated_type
51-
- literal_only_boolean_expressions
52-
- no_adjacent_strings_in_list
53-
- no_duplicate_case_values
54-
- non_constant_identifier_names
55-
- null_closures
56-
- only_throw_errors
57-
- overridden_fields
58-
- package_api_docs
59-
- package_names
60-
- package_prefixed_library_names
61-
- prefer_adjacent_string_concatenation
62-
- prefer_collection_literals
63-
- prefer_conditional_assignment
64-
- prefer_const_constructors
65-
- prefer_contains
66-
- prefer_equal_for_default_values
67-
- prefer_final_fields
68-
- prefer_final_locals
69-
- prefer_generic_function_type_aliases
70-
- prefer_initializing_formals
71-
- prefer_interpolation_to_compose_strings
72-
- prefer_is_empty
73-
- prefer_is_not_empty
74-
- prefer_null_aware_operators
75-
- prefer_single_quotes
76-
- prefer_typing_uninitialized_variables
77-
- recursive_getters
78-
- slash_for_doc_comments
79-
- test_types_in_equals
80-
- throw_in_finally
81-
- type_init_formals
82-
- unawaited_futures
83-
- unnecessary_await_in_return
84-
- unnecessary_brace_in_string_interps
85-
- unnecessary_const
86-
- unnecessary_getters_setters
87-
- unnecessary_lambdas
88-
- unnecessary_new
89-
- unnecessary_null_aware_assignments
90-
- unnecessary_parenthesis
91-
- unnecessary_statements
92-
- unnecessary_this
93-
- unrelated_type_equality_checks
94-
- use_function_type_syntax_for_parameters
95-
- use_rethrow_when_possible
96-
- valid_regexps
97-
- void_checks
11+
always_put_required_named_parameters_first: false
12+
avoid_classes_with_only_static_members: false
13+
lines_longer_than_80_chars: true
14+
always_declare_return_types: true
15+
annotate_overrides: true
16+
avoid_bool_literals_in_conditional_expressions: true
17+
avoid_empty_else: true
18+
avoid_function_literals_in_foreach_calls: true
19+
avoid_init_to_null: true
20+
avoid_null_checks_in_equality_operators: true
21+
avoid_relative_lib_imports: true
22+
avoid_renaming_method_parameters: true
23+
avoid_return_types_on_setters: true
24+
avoid_returning_null: true
25+
avoid_returning_null_for_future: true
26+
avoid_returning_null_for_void: true
27+
avoid_returning_this: true
28+
avoid_shadowing_type_parameters: true
29+
avoid_single_cascade_in_expression_statements: true
30+
avoid_types_as_parameter_names: true
31+
avoid_unused_constructor_parameters: true
32+
await_only_futures: true
33+
camel_case_types: true
34+
# prefer_void_to_null: true
35+
cancel_subscriptions: true
36+
cascade_invocations: true
37+
comment_references: true
38+
# constant_identifier_names: true
39+
control_flow_in_finally: true
40+
directives_ordering: true
41+
empty_catches: true
42+
empty_constructor_bodies: true
43+
empty_statements: true
44+
file_names: true
45+
hash_and_equals: true
46+
implementation_imports: true
47+
invariant_booleans: true
48+
iterable_contains_unrelated_type: true
49+
join_return_with_assignment: true
50+
library_names: true
51+
library_prefixes: true
52+
list_remove_unrelated_type: true
53+
literal_only_boolean_expressions: true
54+
no_adjacent_strings_in_list: true
55+
no_duplicate_case_values: true
56+
non_constant_identifier_names: true
57+
null_closures: true
58+
only_throw_errors: true
59+
overridden_fields: true
60+
package_api_docs: true
61+
package_names: true
62+
package_prefixed_library_names: true
63+
prefer_adjacent_string_concatenation: true
64+
prefer_collection_literals: true
65+
prefer_conditional_assignment: true
66+
# prefer_const_constructors: true
67+
prefer_contains: true
68+
prefer_equal_for_default_values: true
69+
prefer_final_fields: true
70+
prefer_final_locals: true
71+
prefer_generic_function_type_aliases: true
72+
prefer_initializing_formals: true
73+
prefer_interpolation_to_compose_strings: true
74+
prefer_is_empty: true
75+
prefer_is_not_empty: true
76+
prefer_null_aware_operators: true
77+
prefer_single_quotes: true
78+
prefer_typing_uninitialized_variables: true
79+
recursive_getters: true
80+
slash_for_doc_comments: true
81+
test_types_in_equals: true
82+
throw_in_finally: true
83+
type_init_formals: true
84+
unawaited_futures: true
85+
unnecessary_await_in_return: true
86+
unnecessary_brace_in_string_interps: true
87+
unnecessary_const: true
88+
unnecessary_getters_setters: true
89+
unnecessary_lambdas: true
90+
unnecessary_new: true
91+
unnecessary_null_aware_assignments: true
92+
unnecessary_parenthesis: true
93+
unnecessary_statements: true
94+
unnecessary_this: true
95+
unrelated_type_equality_checks: true
96+
use_function_type_syntax_for_parameters: true
97+
use_rethrow_when_possible: true
98+
valid_regexps: true
99+
void_checks: true

coverage_badge.svg

-20
This file was deleted.

lib/client.dart

+12-13
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import 'dart:async';
22
import 'dart:convert';
3+
34
import 'package:contentstack/contentstack.dart';
4-
import 'package:http/http.dart' as http;
55
import 'package:contentstack/src/stack.dart';
6+
import 'package:http/http.dart' as http;
67

78
class HttpClient extends http.BaseClient {
89
final http.Client _client;
@@ -17,14 +18,17 @@ class HttpClient extends http.BaseClient {
1718

1819
HttpClient._internal(this._client, this.stackHeaders, this.stack);
1920

21+
@override
22+
void close() => _client.close();
23+
2024
@override
2125
Future<http.StreamedResponse> send(http.BaseRequest request) {
2226
return _client.send(request);
2327
}
2428

2529
Future<T> sendRequest<T, K>(Uri uri) async {
2630
stackHeaders['Content-Type'] = 'application/json';
27-
stackHeaders['X-User-Agent'] = 'contentstack-dart/0.1.0';
31+
stackHeaders['X-User-Agent'] = 'contentstack-dart/0.1.1';
2832
final response = await http.get(uri, headers: stackHeaders);
2933
Object bodyJson;
3034
try {
@@ -57,17 +61,12 @@ class HttpClient extends http.BaseClient {
5761
}
5862
}
5963

60-
@override
61-
void close() => _client.close();
62-
63-
///////////////////////////////////////
64-
// generic objects as well as List of generic objects (from a JSON list response).
65-
// First, you need to have a function that checks the type of the generic object
66-
// and returns the result of the corresponding fromJson call
67-
// code taken from:
68-
// https://stackoverflow.com/questions/56271651/how-to-pass-a-generic-type-as-a-parameter-to-a-future-in-flutter
69-
///////////////////////////////////////
70-
64+
/// generic objects as well as List of generic objects
65+
/// (from a JSON list response).
66+
/// First, you need to have a function that checks the type of the
67+
/// generic object and returns the result of the corresponding fromJson call
68+
/// code taken from:
69+
/// https://stackoverflow.com/questions/56271651/how-to-pass-a-generic-type-as-a-parameter-to-a-future-in-flutter
7170
static T fromJson<T, K>(dynamic json) {
7271
if (json is Iterable) {
7372
return _fromJsonList<K>(json) as T;

0 commit comments

Comments
 (0)